Switch_viewtopic_banner Does Not Run


Subject: Switch_viewtopic_banner Does Not Run
Hello,

I need to show a banner into the first post only to unregistered user, but the code <!-- BEGIN switch_viewtopic_banner --> does not run.

I open viewtopic.php and try with this code( In version 1.3 and 1.27 run well):
--------------------------------------------------------
Code: [Download] [Hide] [Select]
if ( ($i == 0) && (!$user->data['session_logged_in']))
{
$template->assign_block_vars('postrow.switch_viewtopic_banner', array());
}

----------------------------------------

In the viewtopic_body.tpl i try this code:

-----------------------------------------------------

Code: [Download] [Hide] [Select]
<div class="post-subject {postrow.UNREAD_COLOR}"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" /></a> {postrow.POST_SUBJECT}&nbsp;</div>
&nbsp;
<div class="post-text post-text-hide-flow">

<!-- BEGIN switch_viewtopic_banner -->
ADSENSE CODE
<!-- END switch_viewtopic_banner -->


{postrow.MESSAGE}<br />
{postrow.ATTACHMENTS}
</div>


--------------------------------

Could you help me? Thanks you in advance.

Subject: Re: Switch_viewtopic_banner Does Not Run
I've editted your post above PortalPez, please keep using Code Tags for codes in posts ;)

Subject: Re: Switch_viewtopic_banner Does Not Run
Joshua203 wrote: [View Post]
I've editted your post above PortalPez, please keep using Code Tags for codes in posts ;)


Thanks you and Sorry.... Looks like i am new.... :mrgreen:

Subject: Re: Switch_viewtopic_banner Does Not Run
Anyone?

Subject: Re: Switch_viewtopic_banner Does Not Run
You should just make this edit:

OPEN viewtopic.php
FIND
Code: [Download] [Hide] [Select]
$template->assign_block_vars('postrow.switch_viewtopic_banner', array());

REPLACE WITH
Code: [Download] [Hide] [Select]
if (!$user->data['session_logged_in'])
{
$template->assign_block_vars('postrow.switch_viewtopic_banner', array());
}

Subject: Re: Switch_viewtopic_banner Does Not Run
Thanks you but Does not run... I try with your code, but does not show "Hello word" to unregistered users

I put exactly this:

In viewtopic.php:

Code: [Download] [Hide] [Select]
if (!$user->data['session_logged_in'])
{
$template->assign_block_vars('postrow.switch_viewtopic_banner', array());
}


In viewtopic_body.tpl:

Code: [Download] [Hide] [Select]
<!-- BEGIN switch_viewtopic_banner -->
Hello word
<!-- END switch_viewtopic_banner -->


Thanks you very much!!!

Subject: Re: Switch_viewtopic_banner Does Not Run
I think you are misunderstanding that function.

I would suggest to add a code to viewtopic_body.tpl without altering PHP.

Code: [Download] [Hide] [Select]
<!-- IF not S_LOGGED_IN -->
My Message
<!-- ENDIF -->


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.0751s (PHP: 24% SQL: 76%)
SQL queries: 11 - Debug Off - GZIP Enabled