| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| New Member | 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 ? |
| |
| | #2 (permalink) |
| Recovering Jerk Forum Moderator | 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 ?>
__________________ Proxy Filter SEO Tag Cloud Domain Name Generator Debate Forums Free Online Sudoku | My vBum Blog |
| |
| | #3 (permalink) |
| New Member | 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 ? |
| |
| | #6 (permalink) |
| Senior Member | 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. |
| |
| | #7 (permalink) |
| New Member | 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. |
| |
| | #8 (permalink) |
| Senior Member | 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. |
| |
| | #9 (permalink) |
| NamePros Regular | 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 |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |