html banner problem

April 8, 2011 at 04:06:03
Specs: Windows 7
I am trying to put a banner ad the code for which is html into a php webpage.
I don't seem to be able to find a basic enough explanation of how to do this.Any help would be appreciated.
Thank you

See More: html banner problem

Report •

April 9, 2011 at 20:15:21
You could do it a couple ways.

1.) Close the PHP statement, write the HTML code as you naturally would, and then reopen a PHP statement when needed again. Consider this basic WordPress PHP file as an example:

<div id="content"><h1>Page Title</h1><p >Lorem ipsum...</p></div><div style="clear:both;"></div>
<?php get_footer(); ?>

2.) Use the PHP echo statement to output the HTML code. The above example can be rewritten like this:


echo '<div id="content"><h1>Page Title</h1><p >Lorem ipsum...</p></div><div style="clear:both;"></div>';
get_footer(); ?>

Notice that the echo statement ends in a semicolon (as PHP lines should) and the line being echoed is enclosed in apostrophes, while the HTML attribute values are enclosed in quotes. You can use either or for both HTML and PHP, but don't use apostrophes for PHP & HTML. This is wrong:
echo '<div id='content'><h1>Page Title</h1><p >Lorem ipsum...</p></div><div style='clear:both;'></div>';

The first example is preferred to decrease work load for the web server and load time for the end-user, but of course the PHP echo statement is used when you're outputting a PHP value.

Apologies if I don't respond to your reply immediately. I don't check this site daily, but you're welcome to PM me as a reminder.

Report •
Related Solutions

Ask Question