View Single Post
Old 09-30-2007, 08:20 PM  
Dvae
Confirmed User
 
Dvae's Avatar
 
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
Quote:
Originally Posted by RedShoe View Post
I have a simple Smarty site going. So far so good, but I can't get it to do one thing. The index.php is set up to display: a header, a main, and a footer set of templates.

That part works but inside the main.tpl, I use the fetch function to call in a gallery like page.

That gallery page is created from a database using a different program. (if I knew how to do it with Smarty I would)

However, I'm using the fetch function and trying to call in a page, the actual function looks like this:

{fetch file='http://www.domain.com/directory/videos.html'}

Now the problem is, I need for "directory" be dynamic. It needs to use a smarty function so that I can replace that directory depending on the main page they are on. I've tried making it look like all of the following ways, and none of them work.

{fetch file='http://www.domain.com/$directory/videos.html'}
{fetch file='http://www.domain.com/\$directory/videos.html'}
{fetch file='http://www.domain.com/\'$directory/videos.html'}
{fetch file='http://www.domain.com/{$directory}/videos.html'}
{fetch file='http://www.domain.com/'$directory'/videos.html'}

if I hardcode the directory into the fetch function it works with no problem, but then that would mean I'd need a different template for each page, and the whole point of going with Smarty is to eliminate all those pages.

Anyone know how to call a smarty instance into a fetch function? (or know of an alternative)
I'll take a stab at it, just a wild guess
Use double quotes.
{fetch file="http://www.domain.com/$directory/videos.html"}
Dvae is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote