[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 02-18-2007, 01:54 AM   #1 (permalink)
New Member
 
Join Date: Feb 2007
Posts: 24
0.00 NP$ (Donate)

tonypony is an unknown quantity at this point


Programming PHP Includes

Does anyone know if one can use PHP "includes" ?

I currently use something like :

<?php
require_once("bodymain.php");
?>

This appears above the :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Then add this in the <body>:

<?php
include($result_main);
?>

It enables a rotation of content from /bodymain.php

Can anything like this work in XHTML ?

If so how would one code it ?

If not any other sugestions on 'pulling in' randomized data ?
tonypony is offline  
Old 02-18-2007, 03:04 AM   #2 (permalink)
Recovering Jerk

Forum Moderator

 
labrocca's Avatar
 
Join Date: Aug 2004
Location: Las Vegas
Posts: 5,503
1,196.64 NP$ (Donate)

labrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond reputelabrocca has a reputation beyond repute

Child Abuse Child Abuse
You would echo $result_main like this

<?php echo $result_main; ?>

This is assuming that the variable comes from bodymain.php.

You can also try the short tag

<?=$result_main ?>
labrocca is offline  
Old 02-18-2007, 09:08 AM   #3 (permalink)
New Member
 
Join Date: Feb 2007
Posts: 24
0.00 NP$ (Donate)

tonypony is an unknown quantity at this point


Php

I tried that but I guess I am not too savvy as it did not work.

Do I save the index as .html or .php ?

If PHP it throws up an error on line 6 which is currently ....

<?xml version="1.0" encoding="UTF-8" ?>

Do I need to change that ?

The page coding saved as .html is working but not pulling in the variable includes.

Any ideas ?
tonypony is offline  
Old 02-18-2007, 11:17 AM   #4 (permalink)
In-House Graphic Designer
 
True_Snake's Avatar
 
Join Date: Aug 2004
Location: Toronto, Canada
Posts: 4,306
37,186.96 NP$ (Donate)

True_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud ofTrue_Snake has much to be proud of

Ethan Allen Fund Ethan Allen Fund Ethan Allen Fund Child Abuse Autism
Moved to "Programming" forum ! You'll probably get more exposure from programmers in this section .

Good luck !
True_Snake
__________________

Logos:PM ME!
OVECHKIN.INFO! Rising Star!

True_Snake is offline  
Old 02-18-2007, 11:21 AM   #5 (permalink)
Stud Sausage
 
Join Date: Dec 2006
Location: England
Posts: 1,546
34.41 NP$ (Donate)

Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of

Adoption Breast Cancer Breast Cancer Cancer Survivorship
Can you post your entire code section and a simplified (laymans!) explanation of what you are trying to achieve please.

Didn't get much from your original post

Matt
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline  
Old 02-18-2007, 01:14 PM   #6 (permalink)
tm
Senior Member
 
tm's Avatar
 
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,409
374.65 NP$ (Donate)

tm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of light


XHTML and PHP are entirely different things, so XHTML will work in PHP just as well as HTML does.

For this line:
<?xml version="1.0" encoding="UTF-8" ?>
You must change it to:
<?php echo '<?xml version="1.0" encoding="UTF-8" ?>'; ?>
It's the single disadvantage of enabling short tags, but you needn't worry about that.

Whenever you use <?php in a page, you must use the .php extention. You can still place HTML or whatever inside this page.
__________________
You design in photoshop, I code into valid XHTML/CSS.
Professional PSD, PNG or HTML to tableless XHTML/CSS designs.
For more info, send me a PM.
tm is offline  
Old 02-19-2007, 08:35 AM   #7 (permalink)
New Member
 
Join Date: Feb 2007
Posts: 24
0.00 NP$ (Donate)

tonypony is an unknown quantity at this point


Thanks a lot - Now ... How do we do this for .mobi ?

Guys ... Thanks a bundle.

It works great !!

Check it out please at : http://toons1.mobi

The next step is going to be getting the viral working.

Can anyone advise, bearing in mind the platform is likely a mobile phone.

a) If I can include code for a "tell a friend" ?

b) Bookmark to the mobile device ?

c) Code a button to refresh ( as the 'toon' changes on every refresh ) this may not be needed if most mobiles have 'refresh' as a hardwire option.

Any suggestions.

Last edited by tonypony; 02-19-2007 at 08:38 AM.
tonypony is offline  
Old 02-19-2007, 09:13 AM   #8 (permalink)
tm
Senior Member
 
tm's Avatar
 
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,409
374.65 NP$ (Donate)

tm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of light


For refresh you can simply make a link to the same page to ensure that it works on every single browser. Not sure on bookmark for mobiles. Look on www.hotscripts.com for tell a friend.
__________________
You design in photoshop, I code into valid XHTML/CSS.
Professional PSD, PNG or HTML to tableless XHTML/CSS designs.
For more info, send me a PM.
tm is offline  
Old 02-20-2007, 11:07 PM   #9 (permalink)
NamePros Regular
 
Join Date: Jul 2005
Posts: 274
38.00 NP$ (Donate)

TrafficSecret is just really niceTrafficSecret is just really niceTrafficSecret is just really niceTrafficSecret is just really niceTrafficSecret is just really nice


Another trick to allow xml to work like php (most people dont know this one)

add this line to your .httacces file

<Files "filename.xml">
AddType application/x-httpd-php .xml
</Files>

TS
__________________
~TrafficSecret~
KickAssMovies.com - Funny Movies and Hot Babes
Unsober.com - Drunken Media
OvtCheck.com - Domain Tools
HumorTrade.com - Humor Site Banner Exchange
TrafficSecret is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 06:27 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85