Php template question

by 7 replies
9
I have this php template with which i am able to display an amazon astore on my wordpress site. I am wondering if there is a way for me to include a section in which I can also have text or html display on top or underneath.

<?php
/*
Template Name:A Store
*/
?>
<?php get_header(); ?>
<iframe src="http://astore.amazon.com/" width="100%" height="4000" frameborder="0" scrolling="no"></iframe>
<?php get_footer(); ?>
#programming #php #question #template
  • right above the IFRAME:

    echo "
    YOUR TEXT OR HTML
    ";
    • [ 1 ] Thanks
  • I can't post text or images yet, so I'm giving you a pastebin link.

    Here is an improved version of your script:

    pastebin(dot)com/0EwNZyfc

    As for putting in HTML wherever you want, you can already do that in PHP. You just can't put raw HTML code inside of <?php ?> brackets unless if in quotations for assignment to a variable or echoing a command. I don't really know how to explain it.

    Here is an example


    <!DOCTYPE html>
    <html>
    <head>
    <title>My webpage</title>
    </head>
    <body>
    The current year is <?php echo date('Y')?>. Your IP address is <?php echo $_SERVER['REMOTE_ADDR'];?>.
    </body>
    </html>


    Note to moderators: I tried to use the PHP tags but the page simply went blank when I tried to preview it if I had actual PHP code within the tags. This is the best I could do.
    • [ 1 ] Thanks
    • [1] reply
    • I can't post text or images yet, so I'm giving you a pastebin link.

      Here is an improved version of your script:

      pastebin(dot)com/0EwNZyfc

      As for putting in HTML wherever you want, you can already do that in PHP. You just can't put raw HTML code inside of <?php ?> brackets unless if in quotations for assignment to a variable or echoing a command. I don't really know how to explain it.

      Here is an example


      <!DOCTYPE html>
      <html>
      <head>
      <title>My webpage</title>
      </head>
      <body>
      The current year is <?php echo date('Y')?>. Your IP address is <?php echo $_SERVER['REMOTE_ADDR'];?>.
      </body>
      </html>


      Note to moderators: I tried to use the PHP tags but the page simply went blank when I tried to preview it if I had actual PHP code within the tags. This is the best I could do.[/QUOTE]

      Can't use Quote function either.

      Thanks again very good looking example, very helpful.

      <?php /* Dynamic usage example: http://yourwebsite.com/filename.php?name=appl - Pastebin.com
      • [1] reply
  • Thank you FirstSocialApps and MeanWalrus for your help. This gives the help I needed. :-)
    • [1] reply
    • No problem, feel free to contact me if you need any more help.
      • [ 1 ] Thanks
  • upload code in header.php

Next Topics on Trending Feed

  • 9

    I have this php template with which i am able to display an amazon astore on my wordpress site. I am wondering if there is a way for me to include a section in which I can also have text or html display on top or underneath. <?php