Page 1 of 1

News Detail URL problems after upgrade

Posted: Tue Jun 17, 2014 1:48 pm
by kerryshamblin
After upgrading from 1.10.xx to 1.11.10, I'm having a problem with the {anchor} tags in my news articles. I have PrettyURLs active. The News Options have the Default page to use for detail views set as a page with the alias "newsletter-page". Each news article has a specified page URL such as: newsletter/2014/June. Additionally, news articles have anchor tags set such as: {anchor anchor='01' text='Link Text'}. The call for the news module looks like this: {news category="2014" detailpage="newsletter-page" sortasc="true" }

Before the upgrade, the internal page anchor links were working fine. Now, they lead to /newsletter-page#01 rather than /newsletter/2014/June#01.

I have {metadata} tag in my header. I tried adding showbase=false and showbase=true, but that didn't clear up the problem. I also tried removing the detailpage specification from the News module call, but that didn't help either.

Here is an example of a news article, with the anchor links under the "Contents" section: http://rienstraclinic.com/newsletter/2014/June/

Here is the news detail template:

Code: Select all

{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{if isset($entry->canonical)}
  {assign var='canonical' value=$entry->canonical}
{/if}

<div class="news-nav">
<p>
{prev_next pageid=$page_id currid=$entry->id currdate=$entry->postdate}
</p>
<p>{if $news_prev_url}<a href="{$news_prev_url}"><< Previous</a> &nbsp;| {/if}{if $news_next_url}&nbsp;<a href="{$news_next_url}"> Next >></a>{/if}
<br /><a href="/newsletter/archive/">Newsletter Archives</a>
</p>
</div>

<h3 id="NewsPostDetailTitle">{$entry->title|cms_escape:htmlall}</h3>


<div id="NewsPostDetailContent">
	{eval var=$entry->content}
</div>

{if $entry->extra}
	<div id="NewsPostDetailExtra">
		{$extra_label} {$entry->extra}
	</div>
{/if}

<div id="NewsPostDetailPrintLink">
	{$entry->printlink}
</div>


{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsDetailField">
        {if $field->type == 'file'}
	  {* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}:&nbsp;{eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}
Thank you for your consideration.

Re: News Detail URL problems after upgrade

Posted: Tue Jun 17, 2014 9:10 pm
by velden
Looking at /plugins/function.anchor.php file I see it has changed the way it retrieves 'current url'. I think that causes the problem in your case.

It seems that the old version reads url from http request and current version gets url from current content object (page).