PHP Issue: How Do I insert raw HTML into .PHP scripts?

by 8 replies
11
The situation is like this:

I am using a shopping cart script that is coded in .php , and I want to add on a google analytic script to the index.php .

How do I actually add the raw html coding into the .php file?

Regards,
Ed
#programming #html #insert #issue #php #raw #scripts
  • If it's inside the PHP code you should use something like:

    echo '<b>this is html';

    If it's outside, you can simply put it straight away.
    • [ 1 ] Thanks
    • [2] replies
    • This is a simple request, but you will need to do this somewhere suitable in the script - I.E
      somewhere that is not in a loop, and if statement and such.


      If you want to do this at the end of the script, you can do this after the closing PHP tag, which is - however, this may not be the best place for it.

      If you need to insert it before the end of the PHP script, you will need to

      close the tag;

      and then reopen the tags


      Alternatively, and this may be the safer option for you, if you do not want to break the php tags you can simply do the following in a suitable location.



      If the index.php has a footer section, this would be an ideal location, just before the closing </html> tag.
      • [ 1 ] Thanks
      • [1] reply
    • So:

      echo '<b>this is html';
      <html>
      <etc. etc. etc.>
      </html> ?

      paste anywhere within the script?
  • Think people have their own way of doing this and might be confusing.

    Send the file to me, tell me exactly where you'd like it and I'll send it back with code inserted.

    Don't thank me, just give me money (joke)

Next Topics on Trending Feed