Unstoppable Domains

Programming PHP Includes

Spaceship Spaceship
Watch

tonypony

Established Member
Impact
1
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 ?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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 ?>
 
0
•••
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 ?
 
0
•••
Moved to "Programming" forum :tu: ! You'll probably get more exposure from programmers in this section :imho: .

Good luck :gl: !
True_Snake
 
0
•••
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
 
0
•••
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.
 
0
•••
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:
0
•••
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.
 
0
•••
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
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back