• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Banner rotator - doladenie sablony
PostPosted: Sat Sep 22, 2012 10:51 am 
Offline
Forum Members
Forum Members

Joined: Wed Mar 16, 2011 9:13 am
Posts: 206
Zdravim

v CMSMS som vymyslel sablonu pre rotovanie banerov respektive content blokov vid nizsie

Mam ale problem: ked je napr. content block banner_1 banner_2 a banner_3 prazdny a vyplneny je content block banner_4 a banner_5
a {capture assign='banner'}banner_{1|rand:5}{/capture} vygeneruje cislo od 1 do 3 vzdy sa zobrazi banner podla tejto podmienky
{elseif $banner_4}
{$banner_4}
{else}
teda banner_4
to znamena ze banner_4 bude zobrazovat pri vygenerovanom cisle 1,2,3,4 a teda sa bude zobrazovat omnoho castejsie ako banner_5
(tento problem nie je pokial su vsetky content blocky teda banner_1 az 5 vyplnene)

Neda sa to nejako vyriesit aby banneri zobrazovalo uplne nahodne a skoro rovnomerne?

\$1:
{content block='banner_1' assign='banner_1' label='1. Banner' wysiwyg='false'}
{content block='banner_2' assign='banner_2' label='2. Banner' wysiwyg='false'}
{content block='banner_3' assign='banner_3' label='3. Banner' wysiwyg='false'}
{content block='banner_4' assign='banner_4' label='4. Banner' wysiwyg='false'}
{content block='banner_5' assign='banner_5' label='5. Banner' wysiwyg='false'}

{capture assign='banner'}banner_{1|rand:5}{/capture}

<div>
{if $banner_1 and $banner == 'banner_1'}
{$banner_1}
{elseif $banner_2 and $banner == 'banner_2'}
{$banner_2}
{elseif $banner_3 and $banner == 'banner_3'}
{$banner_3}
{elseif $banner_4 and $banner == 'banner_4'}
{$banner_4}
{elseif $banner_5 and $banner == 'banner_5'}
{$banner_5}
{else}
{if $banner_1}
{$banner_1}
{elseif $banner_2}
{$banner_2}
{elseif $banner_3}
{$banner_3}
{elseif $banner_4}
{$banner_4}
{else}
{$banner_5}
{/if}
{/if}
</div>


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Banner rotator - doladenie sablony
PostPosted: Tue Oct 09, 2012 7:46 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Oct 10, 2006 5:00 pm
Posts: 448
Location: Bratislava
Skusil by som konstrukciu while:

http://www.smarty.net/docs/en/language. ... .while.tpl

\$1:
{while trim($banner) != ''}
{capture assign='banner'}banner_{1|rand:5}{/capture}
{/while}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Banner rotator - doladenie sablony
PostPosted: Wed Oct 10, 2012 5:53 pm 
Offline
Forum Members
Forum Members

Joined: Wed Mar 16, 2011 9:13 am
Posts: 206
kuzmany \kuzmany:
Skusil by som konstrukciu while:

http://www.smarty.net/docs/en/language. ... .while.tpl

\$1:
{while trim($banner) != ''}
{capture assign='banner'}banner_{1|rand:5}{/capture}
{/while}


myslis takto? a co znamena to trim pri while?

\$1:
{content block='banner_1' assign='banner_1' label='1. Banner' wysiwyg='false'}
{content block='banner_2' assign='banner_2' label='2. Banner' wysiwyg='false'}
{content block='banner_3' assign='banner_3' label='3. Banner' wysiwyg='false'}
{content block='banner_4' assign='banner_4' label='4. Banner' wysiwyg='false'}
{content block='banner_5' assign='banner_5' label='5. Banner' wysiwyg='false'}

<div>
{while trim($banner) != ''}
{capture assign='banner'}banner_{1|rand:5}{/capture}
{/div}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting