Page 1 of 1

Feedburner pocitadlo tag - ako urobit podmienku if?

Posted: Sun Jul 29, 2012 6:51 pm
by Joseph777
Zdravim

vytvoril som uzivatelske tag feedburner_counter, ktory mera pocet citatelov feedu vo feedburneri (viď nižšie), problem ale mam s vytvorenim podmienky s tymto tagom

toto mi nefunguje v sablone (asi treba v tom tágu assignovat premennu ale neviem ako):

{feedburner_counter assign="feedburner_counter"}
{$feedburner_counter}
{if $feedburner_counter=="1"}čitateľ
{elseif $feedburner_counter>="2" and $feedburner_counter<="4"}čitatelia
{else}čitateľov
{/if}

Code: Select all

//get cool feedburner count
$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=nieco-sk";
 
//Initialize the Curl session
$ch = curl_init();
 
//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);
 
//Execute the fetch
$data = curl_exec($ch);
 
//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$feedburner_counter = $xml->feed->entry['circulation'];
//end get cool feedburner count
 
echo $feedburner_counter;

Re: Feedburner pocitadlo tag - ako urobit podmienku if?

Posted: Sun Jul 29, 2012 8:27 pm
by kuzmany
2 mozne riesenia:

Code: Select all

{capture assign="feedburner_counter"}{feedburner_counter}{/capture}
alebo dopln na konci tagu namiesto echo $feedburner_counter; tento kod:

Code: Select all

$smarty = cmsms()->GetSmarty();
if($params["assign"])
$smarty->assign($params["assign"],$feedburner_counter);
else
echo $feedburner_counter;

Re: Feedburner pocitadlo tag - ako urobit podmienku if?

Posted: Sun Jul 29, 2012 9:02 pm
by Joseph777
diky moc kuzmany