anchor problem in news

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Mesmer

anchor problem in news

Post 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?  ???
Last edited by Mesmer on Mon Dec 03, 2007 8:44 pm, edited 1 time in total.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: anchor problem in news

Post by tsw »

looks like it does a double html entities at some point (& s in the url)
Mesmer

Re: anchor problem in news

Post 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
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: anchor problem in news

Post 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;
Mesmer

Re: anchor problem in news

Post by Mesmer »

Your code didn't work.
For the time being I've switched on Pretty URL's and that worked.
aozuas

Re: anchor problem in news

Post 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/
Mesmer

Re: anchor problem in news

Post by Mesmer »

aozuas wrote:
Now its working fine. See here a news working example:
http://www.drsamirhaje.com/news/11/59/
That doesn't tell anything because you use pretty urls and as I stated there is no anchor problem when using pretty urls.
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: anchor problem in news

Post 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".
Last edited by kermit on Mon Dec 03, 2007 8:58 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
aozuas

Re: anchor problem in news

Post by aozuas »

Mesmer
In fact my solution works with or without Pretty URL activated.
Did you try it?
Locked

Return to “CMSMS Core”