smarty question regarding $urllinks

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
struba
Forum Members
Forum Members
Posts: 15
Joined: Fri Jul 27, 2007 1:33 pm

smarty question regarding $urllinks

Post by struba »

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
thoms
Forum Members
Forum Members
Posts: 84
Joined: Tue Dec 25, 2007 5:56 pm

Re: smarty question regarding $urllinks

Post by thoms »

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
Vin

Re: smarty question regarding $urllinks

Post by Vin »

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/
struba
Forum Members
Forum Members
Posts: 15
Joined: Fri Jul 27, 2007 1:33 pm

Re: smarty question regarding $urllinks

Post by struba »

thoms wrote:
I have to say that I don't really understand your problem. $urllink is "made up" exactly before your eyes.
yeah you are right :-[. i figured that out in the mean time. I'm going to check out the code in my index file now and see what gives.

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

Return to “Developers Discussion”