Jump to content


Photo

php index file


  • Please log in to reply
3 replies to this topic

#1 LOUCHATS23

LOUCHATS23
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 08 September 2006 - 05:40 PM

Hi, I am very new to php and very familiar with html.  A friend has created a dynamic web site in php and I am trying to help him change the headings for his site.  I am used to index.htlm and how to use it..... but now in see index.php.  Totally unfamiliar with php, how can I add some html tags  to the header?????

Thank you for your help!
Mary Andersen

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 08 September 2006 - 05:43 PM

If your friend has coded the site in PHP. Then you'll want to find the PHP file or code that creates the header. Most probably in a file called header.php or something. or if your friend uses a PHP script that s/he has installed then you'll want to login to the admin control panel or find the config file to change the header.

But to add Html into a php file use echo:
echo "<h1>My Site heading";

make sure echo is between <?php and  ?>, you just add your html outside of the <?php ?> tags, eg:
<h1>My Site heading</h1>
<?php

// my php

?>
more html


#3 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 08 September 2006 - 05:43 PM

Open up your 'index.php' file, now you can add all the HTML you want, as long as you stay outside the <?PHP ?> tags.

Now if you want/need to add HTML inside the <?PHP ?>, you can but you have to do it inside an echo/print statement.

It would be easier if you post the file and what you trying to put in it.

Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#4 mewhocorrupts

mewhocorrupts
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts
  • LocationParker, CO

Posted 08 September 2006 - 06:41 PM

Hi, I am very new to php and very familiar with html.  A friend has created a dynamic web site in php and I am trying to help him change the headings for his site.  I am used to index.htlm and how to use it..... but now in see index.php.  Totally unfamiliar with php, how can I add some html tags  to the header?????


If you have the HTML file ready to go, you can save some time, and make the code a little more modular, if you do something like the following:

<html>
...
<body>
HTML to be displayed via a PHP script...
</body>

</html>

And the PHP:
<?php
...
include("name_of_html_file.htm");
..
?>

Just place the aforementioned code at whatever point you require the html to be displayed.  If it's in the header, then just place it at the top of the PHP file.  Just remember that if you are using sessions, be sure to have the session initialize before you include the HTML file.

-mewhocorrupts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users