Echo file contents - Get current URL

Echo file contents - Get current URL

Postby AlikanSparkes on Mon Nov 12, 2012 2:31 pm

I have searched this forum, and so far not found an answer.

1. How do I get the current URL? In the {php} if I give it a file path, it will do it from the very root folder with the main index.php

How would I get the current Url? Something like templates/blog_1/GreenLeaves/<file>

Is that the only way?

Maybe there is an easier way in SMARTY.
I am trying to get the contents of a file, and echo it, paste it. I am doing a headline at the top, with an easy changer page somewhere else on the blog. I have a small file in the template which holds the current headline.

Any ideas?

Posts: 2
Joined: Mon Nov 12, 2012 1:38 pm
LifeType Version: 1.2.11

Re: Echo file contents - Get current URL

Postby jondaley on Mon Dec 17, 2012 10:56 pm

Do you know about:
Code: Select all
<script type="text/javascript" src="{$url->getTemplateFile("script.js")}"></script>

Does that do what you want?

If you are trying to do a readfile() or something like that, you could try:
{include file="$blogtemplate/header.template"}
But, the file would have to be in smarty format (which plain text would work, you just have to be careful with { and } mostly.

If you need something fancier than that, you will probably have to add a smarty plugin (see class/template/smarty/plugins/ for examples - they are pretty easy to copy and make a new one)
Lifetype Expert
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Return to Templates