Jump to content

Archived

This topic is now archived and is closed to further replies.

LOUCHATS23

php index file

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:
[code=php:0]echo "<h1>My Site heading";[/code]

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

// my php

?>
more html[/code]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote author=LOUCHATS23 link=topic=107374.msg430763#msg430763 date=1157737236]
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?????
[/quote]

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:

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

</html>
[/code]

And the PHP:
[code]
<?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.[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.