Hi!
I have a question regarding Smarty. There is a custom php script running on my server. I didn't write that but I'm trying to figure out how it works so i can implement another function. The person who made it used Smarty template engine and I can not quite figure out what happens.
This is the first part of the script, the comment on the first line says: load links from news feeds
// laad de links van de news feeds
$urllinks = array();
foreach($params['items'] as $item) {
$url = $item->link;
$title = strtolower($item->title);
// strip trailing "/somenumber" part
$url = ereg_replace("(/news/[0-9]*)/(.*)","\\1/", $url);
$urllinks[$title] = trim($url);
}
It makes an array of all the stuff in $urlinks but where can I figure out how $urllinks is made up?
Thanks in advance!
Struba
smarty question regarding $urllinks
Re: smarty question regarding $urllinks
As far as I can see, your question has nothing to do with CMS made simple, right?
So you're a little bit at the wrong place in this forum.
Further, your question has also nothing to do with smarty, but only plain PHP.
Some hints:
The funktrion creates an associative array called "$urllinks" and fills it with the data from another array called "params".
Thereby the key of the array is the string "$title" and the value seems to be an $url.
See the PHP manual:
http://de.php.net/manual/en/language.types.array.php
I have to say that I don't really understand your problem. $urllink is "made up" exactly before your eyes.
Thomas
So you're a little bit at the wrong place in this forum.
Further, your question has also nothing to do with smarty, but only plain PHP.
Some hints:
The funktrion creates an associative array called "$urllinks" and fills it with the data from another array called "params".
Thereby the key of the array is the string "$title" and the value seems to be an $url.
See the PHP manual:
http://de.php.net/manual/en/language.types.array.php
I have to say that I don't really understand your problem. $urllink is "made up" exactly before your eyes.
Thomas
Re: smarty question regarding $urllinks
So... if I understand it correctly, you're trying to find out how the output of $urllinks is sent to Smarty templates.
If so, try looking for smarty_assign function in the code.
There is a documentation for Smarty, too - http://www.smarty.net/
If so, try looking for smarty_assign function in the code.
There is a documentation for Smarty, too - http://www.smarty.net/
Re: smarty question regarding $urllinks
yeah you are rightthoms wrote:
I have to say that I don't really understand your problem. $urllink is "made up" exactly before your eyes.

Thanks,
Struba
Last edited by struba on Thu Apr 24, 2008 12:47 pm, edited 1 time in total.