In TPsubs.template.php we have
<span class="article_category">' . $txt['tp-fromcategory'] . '<a href="' . $scripturl . '?cat=' . $context['TPortal']['article']['category'] . '">' . $context['TPortal']['article']['category_name'] . '</a></span>';What is the $context['TPortal']['article']['?_?'] one to echo the short name of a category? Couldn't find that myself
Target: force the article block to put short names of the category in links, not the category id.
Even if i set a short name for a category, the link is still like
Quotemysite.com/index.php?cat=3
not:
Quotemysite.com/index.php?cat=myshortname
although if I just enter the address like that - it works!
I'll have to take a look when I get a chance. If you don't hear from me in a day or two feel free to bump to give me a reminder.
upup
still need the solution
You have to wait until he have had time to look at it
On which page are you seeing the category URL not picking up your shortname? If it's the frontpage, what do you have set to display on the frontpage?
Quote from: IchBinâ,,¢ on April 07, 2012, 07:59:07 PM
On which page are you seeing the category URL not picking up your shortname? If it's the frontpage, what do you have set to display on the frontpage?
It is frontpage.
I have links like:
mysite.com/index.php?cat=3I want links like:
mysite.com/index.php?cat=myshortname
Quote from: fnrtshdev on April 07, 2012, 10:07:26 PM
Quote from: IchBinâ,,¢ on April 07, 2012, 07:59:07 PM
On which page are you seeing the category URL not picking up your shortname? If it's the frontpage, what do you have set to display on the frontpage?
It is frontpage.
I have links like: mysite.com/index.php?cat=3
I want links like: mysite.com/index.php?cat=myshortname
For my front page it displays just fine, hence the reason I asked you some questions which you didn't seem to answer. Please answer each of these questions:
1. What is set to display on your front page? Forum posts? Only Articles? Both?
2. Where is the category link you are talking about? Is it in the article somewhere? Is it in the linktree?
1. Only articles (tried using both - didn't change anything)
2. The category link i described is
only at the mainpage, the
QuoteWritten by *author* posted in *Category name* *Date* *Views* *Rating * Edit Print
part under the article name.
The code part that i posted in the 1st post is resposible for that place.
In the linktree it's just ok, but the code part responcible for the linkree doesn't suit for that place.
I want to have the same catergory link on the mainpage.
if(!empty($context['TPortal']['article']['category_name']))
{
if(isset($context['TPortal']['article']['boardnews']))
$code = '
<span class="article_category">' . $txt['tp-fromcategory'] . '<a href="' . $scripturl . '?board=' . $context['TPortal']['article']['category'] . '">' . $context['TPortal']['article']['category_name'] . '</a></span>';
else
$code = '
<span class="article_category">' . $txt['tp-fromcategory'] . '<a href="' . $scripturl . '?cat=' . $context['TPortal']['article']['category'] . '">' . $context['TPortal']['article']['category_name'] . '</a></span>';
} Again, this is the place in TPsubs.template.php that i need to edit, to be more exact:
' . $context['TPortal']['article']['category'] . 'I don't know what can I insert here, ' . $context['TPortal']['article']['category_shortname'] . ' doesn't work. This is just the place I need your help in.
Looks like category shortname was never taken into account for the article information when displayed on the front page for any front page setting. Thanks for clarifying where you were seeing the link. There's quite a few small changes to make this work. If you'd like you can just use these files assuming you are using TP 1.0.
Let me know if there are any problems.
Thanks, that seems to work!
Didn't notice any problems with that - I'll post here if something strange occurs!
Thank you for your help, would be nice if it will be included in the next release!
Up
One little issue: after this patch, links like that started to appear in a linktree, but here's a solution to fix that:
In file TPortal.php (around line 1214)
find: TPadd_linktree($scripturl.'?cat='. $context['TPortal']['category']['id'] , $context['TPortal']['category']['value1']);
replace with: TPadd_linktree($scripturl.'?cat='. $context['TPortal']['category']['value8'] , $context['TPortal']['category']['value1']);
That'll change what you need. But it doesn't account for the option if someone doesn't actually have a shortname, in which case it should be using the id instead.
if(!empty($context['TPortal']['category']['shortname']))
TPadd_linktree($scripturl.'?cat='. $context['TPortal']['category']['value8'], $context['TPortal']['category']['value1']);
else
TPadd_linktree($scripturl.'?cat='. $context['TPortal']['category']['id'], $context['TPortal']['category']['value1']);