GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   anyone here know how to... (https://gfy.com/showthread.php?t=773086)

RedShoe 09-30-2007 07:58 PM

anyone here know how to...
 
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)

peterk 09-30-2007 08:03 PM

Sorry, I cannot help you but here is a bump

Aussie Rebel 09-30-2007 08:08 PM

Sorry mate I don't know either, but bump for someone else that might know

Dvae 09-30-2007 08:20 PM

Quote:

Originally Posted by RedShoe (Post 13167843)
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"}

RedShoe 09-30-2007 08:27 PM

Quote:

Originally Posted by Dvae (Post 13167902)
I'll take a stab at it, just a wild guess
Use double quotes.
{fetch file="http://www.domain.com/$directory/videos.html"}

Double quotes? That's the dumbest..



HOLY SHIT!!!! THAT WORKED!!!!

Thanks DVAE!!

RedShoe 09-30-2007 08:28 PM

admins, you may close this thread now.

AsianDivaGirlsWebDude 09-30-2007 08:30 PM

Quote:

Originally Posted by RedShoe (Post 13167925)
Double quotes? That's the dumbest..



HOLY SHIT!!!! THAT WORKED!!!!

Thanks DVAE!!

Best compliment ever... :1orglaugh

ADG

Dvae 09-30-2007 08:36 PM

Quote:

Originally Posted by RedShoe (Post 13167925)
Double quotes? That's the dumbest..



HOLY SHIT!!!! THAT WORKED!!!!

Thanks DVAE!!

Its known as variable interpolation

Single quotes are literal, meaning it will display exactly what you put in it.- No interpolation

Whereas double quotes do.

2012 09-30-2007 08:38 PM

sounds stupid but ...
 
oops you got it

kmanrox 09-30-2007 08:48 PM

what's Smarty? do u have a link for more info?

2012 09-30-2007 08:49 PM

Quote:

Originally Posted by kmanrox (Post 13167990)
what's Smarty? do u have a link for more info?

It has a little learning curve but the more I use it the more I'm loving it.
http://smarty.php.net/download.php


All times are GMT -7. The time now is 10:12 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123