NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Programming PHP Includes

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-18-2007, 02:54 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Feb 2007
Posts: 24
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, 04:04 AM   #2 (permalink)
NamePros Expert
 
labrocca's Avatar
Join Date: Aug 2004
Location: Las Vegas
Posts: 6,277
labrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatnesslabrocca Has achieved greatness
 



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 ?>
__________________
:$: Support Forum <-- My latest endeavor.:loveyou:
Debate Forums Free Online Sudoku My vBum Blog
labrocca is offline  
Old 02-18-2007, 10:08 AM THREAD STARTER               #3 (permalink)
New Member
Join Date: Feb 2007
Posts: 24
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, 12:17 PM   #4 (permalink)
In-House Graphic Designer
 
True_Snake's Avatar
Join Date: Aug 2004
Location: Toronto, Canada
Posts: 4,289
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 ofTrue_Snake has much to be proud of
 

Member of the Month
August 2005
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, 12:21 PM   #5 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,568
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
Matthew. is offline  
Old 02-18-2007, 02:14 PM   #6 (permalink)
tm
Senior Member
 
tm's Avatar
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,408
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, 09:35 AM THREAD STARTER               #7 (permalink)
New Member
Join Date: Feb 2007
Posts: 24
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 09:38 AM.
tonypony is offline  
Old 02-19-2007, 10:13 AM   #8 (permalink)
tm
Senior Member
 
tm's Avatar
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,408
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-21-2007, 12:07 AM   #9 (permalink)
NamePros Regular
Join Date: Jul 2005
Posts: 274
TrafficSecret is just really niceTrafficSecret is just really niceTrafficSecret is just really niceTrafficSecret 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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:22 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger