Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

adding html to a php page


Recommended Posts

I couldn't find how to do this in the help section of the website - only how to change the text.


But I have a layout in html that I want to put on my home page - i just want it to go in the main body of the page.. where in the code would i paste it? is there any php code that needs to surround it or anything?

Link to comment
Share on other sites

if you are talking about the home page as in the first page that loads from your root, then that's easy.


just go to your index.php file and do a search for this:



} else { // default page



It is very near the end of the page.


Everything after this command will get executed and seen on the home page.

If all you have is html then you can put all the code you need after that " ?> " code.


To make it as easy as possible, simply locate this other code that is couple lines after the " else // default page"


<td class="main"> <?php echo TEXT_MAIN; ?> </td>


Just delete "<?php echo TEXT_MAIN; ?>" and then put your html code in between those <Td>


That is essentially what displays on the home page.


(that php code simply calls all of that nonsense text from another page, but why would u want to edit that other page when you can just directly paste code right in there)


Well I hope this helps, and you can even play around with the other <td> following the else default,

to further edit your page.


Have fun

Link to comment
Share on other sites

hey 2 questions how do i make an anchor link, i tried ,


a href="#top">go to top</a>


but it didn't work, is it needed to make it in php so as no session loss is there.


also can't i have an image directly, just as the simple html code rather than converthing it to html


<img src="img.gif">



Link to comment
Share on other sites

Hello, here is a short tutorial on anchor links by Yahoo


Note that you need TWO links. One link will simply jump to the other link of the same, matching name.


As for your image tags. Yes any html code is valid but you must make sure to NOT put them between

any <?php ?> tags, else they will get interpreted as php. (of course you can put html in php but I sense this is not what you're shooting for?)


Your image tags should always work, because if you accidently put them in the php brackets then your whole page will break and you will get errors. So if you're not getting errors then your in the right place.


You also may not be seeing them because you are putting them in "if statements" that do not get run.


On the main pages like index.php, product_info.php, there are 3 or more cases of code that get run based on values. For example in the index.php page there is the default home page, the categories sub menu with products, and categories submenu without products. So if you are putting code in the default home page, obviously it won't get run in the other pages.


If your images are in the header/footer pages, then you should be fine.


Hope this helps.

Link to comment
Share on other sites


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

  • Create New...