|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
GettinBetter Smarty n00b
Joined: 25 Feb 2014 Posts: 2 Location: Kent, United Kingdom
|
Posted: Tue Feb 25, 2014 9:30 am Post subject: Url Link Formation |
|
|
Hi Guys,
I have searched this subject, and although there are a few similar threads, non seem to help me...
I'm dead new to Smarty, and basically need to add some help files to my site.
I want to use a single file with named anchors to get the right help topic showing when the users help window opens.
The link is a simple question mark graphic, linked to the help file (currently called test.tpl)
test.tpl has all the help topics with standard <a name="apha"></a> anchors at the appropriate places down the list.
It works if I just use...
HTML
Code: | <a href="index.php?a=28&b=152&help=test&aname=#alpha" class="lightUpLink" onclick="return false;"> |
Code: | {include file="help_pages/{$smarty.get.help|escape:'url'}.tpl"} |
But doesn't open at the correct help topic, it always starts at the top of the page.
However, I need to include the "#alpha" part.
I've tried
Code: | {include file="help_pages/{$smarty.get.help|escape:'url'}.tpl}{$smarty.get.aname"} |
but 'aname' isn't a filename, so I expected this not to work.
I hope I've given you enought info,and any help would be greatly appreciated
I don't understand all the server stuff, but I'm willing to learn, so please be gentle with me.
Regards
GB |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 25, 2014 2:57 pm Post subject: |
|
|
You are using data directly from GET to assemble a filepath. You are better off cleansing that data PHP side and pass a value to Smarty that can be used directly. Something like
// strip out rogue characters
$smarty->assign('help', preg_replace('!\W+!','', $_GET['help']));
in template:
{include file="help_pages/`$help`.tpl"}
If you had to hack the template you could make it work.
{capture assign="help"}{$smarty.get.help|escape:'url'}{/capture}
{include file="help_pages/`$help`.tpl"} |
|
Back to top |
|
novasmart Smarty n00b
Joined: 13 Sep 2014 Posts: 1
|
Posted: Sat Sep 13, 2014 4:40 pm Post subject: |
|
|
Hello GettinBetter!
Did you solve the problem?
I have a similar problem. I got a message below. If you solved the problem, please share with me.
Thnaks,
Rob
Template Error: Template file not found!
The template file main_page/help_pages/".$_tmp1.".tpl could not be found in any of the template sets currently loaded. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Sep 13, 2014 8:19 pm Post subject: |
|
|
You got Smarty bundled with other software, right? Which one?
I assume the template code looks like
Code: | {include file="help_pages/{$smarty.get.help|escape:'url'}.tpl"} |
The error message you got is not an original message of Smarty and must have been generated by the software package.
The custom error message does not evaluate the full template name right, so that you don't see the variable part of the file name.
Assuming my example above {$smarty.get.help|escape:'url'} is the variable part of the file name. It could be that $_GET['help'] is undefined or its value has no help page asociated with it. |
|
Back to top |
|
GettinBetter Smarty n00b
Joined: 25 Feb 2014 Posts: 2 Location: Kent, United Kingdom
|
Posted: Sat Sep 13, 2014 9:03 pm Post subject: |
|
|
Sorry Guys, Can't believe I only just spotted this notification!! and that's because it was a PM??
Ok In order...
@mohrt .... Yes I think you understand what I mean. I can get the file working no problem there...but I was trying the page to scroll to a particular position on the page so that I could list all my help topics on one page.
@novasmart .... No not yet...
@mohrt ... yes I did get it with other software it is used in my sites Auction & Classifieds software from Geodesic. They seem to have set it up to use a new file for each bit help text, which I'm not happy with.
I shown in my first post the code as normal, and my attempt at getting it to use suedo 'named anchors'. I know it was a long shot, but stranger things have happened
What I'm trying to find out is whether it possible to get it to open a page at a particular point? or am I just barking up the wrong tree. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|