Jump to content

Php Code And Div Tags


Dannyeo

Recommended Posts

Hi

 

Would anyone be able to offer some advice? Currently stuck.

 

I have the following code within a PHP file that controls the header banners on my website.

 

function pokies_header_468_60_banner()
{
?>
				 <div class="header_banner" >
					 <?php echo adrotate_group(16); ?>
 </div>
					 <?php
}

 

The banners are not appearing on the site and I think its down to me incorrectly using div and php together in the above code.

 

Any advice would be appreciated - sorry if this is simple but I'm new to this and learning as I go along :tease-03:

Link to comment
Share on other sites

your mixing function and output. you need to do something along these lines:

<?php
function pokies_header_468_60_banner()
{
$output = '<div class="header_banner" >';
$output .= adrotate_group(16);
$output .= '</div>';
return $output;
}
?>

 

then where you need to print it out:

<?php
print pokies_header_468_60_banner();
?>

Edited by gristoi
Link to comment
Share on other sites

Thanks for our help.

 

I've tried the code above but it is crashing the site.

 

It is definitely the div code that is causing me problems. For example I have some sidebar banners that work with the following code:

function pokies_sidebar_160_600_banner()
{
?>
 <?php echo adrotate_group(13); ?>
<?php
}

 

So the real issue I have is how to incorporate the <div class="header_banner" > into the following code which isn't working:

function pokies_header_468_60_banner()
{
?>
 <div class="header_banner" >
					 <?php echo adrotate_group(16); ?>
 </div>
					 <?php
}

Edited by Dannyeo
Link to comment
Share on other sites

An extract from the css is

.header_banner {
float: right;
margin-top: 38.5px;
margin-right: 50px;
    position:relative;
    overflow:hidden;
    width:468px;
    height:60px;
}
.header_banner a {
   /*opacity:0;
   filter:alpha(opacity=0);*/
   display:none;
   position:absolute;
   top:0px;
   left:0px;
}

Link to comment
Share on other sites

I've just done a test by removing the div element.

 

So the following code displays the banners in the header (though they are not in the correct place due to no mention to the CSS to align them):

function pokies_header_468_60_banner()
{
 ?>

					 <?php echo adrotate_group(16); ?> 

					  <?php
}

 

So, the above works OK. Just the alignment of the banners is missing.

 

So when I now add the CSS reference to align the banners it all stops working (despite the source code looking ok):

function pokies_header_468_60_banner()
{
 ?>
  <div class="header_banner" >
					 <?php echo adrotate_group(16); ?> 
  </div>
					  <?php
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.