Commit 884ccae4 authored by Melissa Draper's avatar Melissa Draper
Browse files

Add check for query string on tags page (bug 849898)



If the tags page was visited with "tags.php" via, say,
the sidebar heading, the urls made with the template
were broken; the query string was joined to the baseurl
with a & rather than a ?. This patch checks if the last
8 characters are tags.php and sets a queryprefix value
based on the result.

Change-Id: I56f87b76e9fb82472fda2c6cb2c5315bb3f79c05
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent fb94eca3
......@@ -210,6 +210,13 @@ foreach (array('alpha', 'freq') as $option) {
$tagsortoptions[$option] = $option == $tagsort;
}
if (substr($data->baseurl, -8, 8) == "tags.php") {
$data->queryprefix = '?';
}
else {
$data->queryprefix = '&';
}
$smarty = smarty(array('paginator'));
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('tags', $tags);
......
......@@ -17,16 +17,16 @@
{/if}
<div id="results_container" class="rel tag-results">
<h3 id="results_heading">{str tag=searchresultsfor} <a class="tag" href="{$WWWROOT}tags.php{if $tag}?tag={$tag|urlencode|safe}{/if}">{if $tag}{$tag|str_shorten_text:50}{else}{str tag=alltags}{/if}</a></h3>
<h3 id="results_heading">{str tag=searchresultsfor} <a class="tag" href="{$WWWROOT}tags.php{if $tag}{$results->queryprefix}tag={$tag|urlencode|safe}{/if}">{if $tag}{$tag|str_shorten_text:50}{else}{str tag=alltags}{/if}</a></h3>
<div class="rbuttons"><a class="btn edit-tag{if !$tag} hidden{/if}" href="{$WWWROOT}edittags.php?tag={$tag|urlencode|safe}">{str tag=editthistag}</a></div>
<div id="results_sort" class="fl">{str tag=sortresultsby}
{foreach from=$results->sortcols item=sortfield name=sortcols}
<a href="{$results->baseurl}&type={$results->filter}&sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$.foreach.sortcols.last} <span class="sep">|</span> {/if}
<a href="{$results->baseurl}{$results->queryprefix}type={$results->filter}&sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$.foreach.sortcols.last} <span class="sep">|</span>{/if}
{/foreach}
</div>
<div id="results_filter" class="fr">{str tag=filterresultsby}
{foreach from=$results->filtercols key=filtername item=filterdisplay name=filtercols}
<a href="{$results->baseurl}&sort={$results->sort}&type={$filtername}"{if $results->filter == $filtername} class="selected"{/if}>{$filterdisplay}</a>{if !$.foreach.filtercols.last} <span class="sep">|</span> {/if}
<a href="{$results->baseurl}{$results->queryprefix}sort={$results->sort}&type={$filtername}"{if $results->filter == $filtername} class="selected"{/if}>{$filterdisplay}</a>{if !$.foreach.filtercols.last} <span class="sep">|</span> {/if}
{/foreach}
</div>
<div class="cb"></div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment