Page 1 of 1
anchor problem in news
Posted: Sun Dec 02, 2007 7:43 pm
by Mesmer
I just noticed my page up achor is not working when I view a news article.
When you click on a news article the Page Up link (right bottom) gives this error
string(43) "Smarty error: eval: missing 'var' parameter"
What did I do wrong?

Re: anchor problem in news
Posted: Sun Dec 02, 2007 7:49 pm
by tsw
looks like it does a double html entities at some point (& s in the url)
Re: anchor problem in news
Posted: Sun Dec 02, 2007 7:53 pm
by Mesmer
Thanks for your wuick reply
but how comes it works in ever page accept a news page? The Page Up link is in the footer so always the same
Re: anchor problem in news
Posted: Sun Dec 02, 2007 8:11 pm
by tsw
your news link is the only situation you have url like ?foo=bar&bar=foo
try this
Code: Select all
Index: function.anchor.php
===================================================================
--- function.anchor.php (revision 4268)
+++ function.anchor.php (working copy)
@@ -33,7 +33,7 @@
if (isset($_SERVER['REQUEST_URI']))
{
$url = cms_htmlentities($_SERVER['REQUEST_URI']).'#'.$params['anchor'];
- $url = str_replace('&', '&', $url);
+# $url = str_replace('&', '&', $url);
if (isset($params['onlyhref']) && ($params['onlyhref'] == '1' || $params['onlyhref'] == 'true'))
#Note if you set 'onlyheref' that is what you get - no class or title or tabindex or text
echo $url;
Re: anchor problem in news
Posted: Sun Dec 02, 2007 8:41 pm
by Mesmer
Your code didn't work.
For the time being I've switched on Pretty URL's and that worked.
Re: anchor problem in news
Posted: Sun Dec 02, 2007 9:59 pm
by aozuas
I already have this problem and I solve that way:
1) create the following UDT in admin Extension>User Defined Tags and name it "atual_url":
Code: Select all
function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }
print(selfURL());
2) In your template, put the following code where you want your top link:
Code: Select all
<a href="{atual_url}#" title="Return to top">top</a>
Now its working fine. See here a news working example:
http://www.drsamirhaje.com/news/11/59/
Re: anchor problem in news
Posted: Mon Dec 03, 2007 8:46 pm
by Mesmer
That doesn't tell anything because you use pretty urls and as I stated there is no anchor problem when using pretty urls.
Re: anchor problem in news
Posted: Mon Dec 03, 2007 8:55 pm
by kermit
i can confirm, {anchor} tag while in news details is borked when pretty urls are disabled.
string(43) "Smarty error: eval: missing 'var' parameter"
Mesmer wrote:
For the time being I've switched on Pretty URL's and that worked.
is there a reason why you're not using them in the first place?

google can parse just about any url nowadays, so it's not really about being "search engine friendly" any more (although you/can/still/stuff/keywords), it's about being "people friendly".
Re: anchor problem in news
Posted: Wed Dec 05, 2007 2:37 am
by aozuas
Mesmer
In fact my solution works with or without Pretty URL activated.
Did you try it?