TinyPortal

Development => Support => Topic started by: zsolteey on November 22, 2015, 12:19:29 AM

Title: Category style and date format change
Post by: zsolteey on November 22, 2015, 12:19:29 AM
Hi,

I have to question:
1.
I want to change my categories stlye.
If I edit my block there is option to change the style (titlebg+windowbg, catbg+windowbg, etc.).
Are there any option to change on a graphics way on a category like a block? Or the only way is to change the layout of the category and use custom template?

2.
In the custom template layout category there is some variable ({article_shortdate}, {article_title}, {article_category}, etc).
How can I edit what give back these variables?
The {article_shortdate} is give the date in DD M YYYY format but I want to change it to YYYY M DD.
Is it possible?

Thank you!

Sincerely,
Zsolteey.
Title: Re: Category style and date format change
Post by: illori on November 22, 2015, 12:34:29 PM
Quote from: illori

TPsubs.template.php

function article_shortdate($render = true)
{
global $context;

if(in_array('date',$context['TPortal']['article']['visual_options']))
echo '
<span class="article_shortdate">' . tptimeformat($context['TPortal']['article']['date'], true, '%d %b %Y').' - </span>';
else
echo '';
}


i think that is what you are talking about. TP is not using SMF time formats.

Quote%d   Two-digit day of the month (with leading zeros)
%b   Abbreviated month name, based on the locale   Jan through Dec
%Y   Four digit representation for the year   Example: 2038

http://php.net/manual/en/function.strftime.php


this was posted elsewhere, reposting it here for you.
Title: Re: Category style and date format change
Post by: zsolteey on November 22, 2015, 01:25:11 PM
Quote from: illori on November 22, 2015, 12:34:29 PM
Quote from: illori

TPsubs.template.php

function article_shortdate($render = true)
{
global $context;

if(in_array('date',$context['TPortal']['article']['visual_options']))
echo '
<span class="article_shortdate">' . tptimeformat($context['TPortal']['article']['date'], true, '%d %b %Y').' - </span>';
else
echo '';
}


i think that is what you are talking about. TP is not using SMF time formats.

Quote%d   Two-digit day of the month (with leading zeros)
%b   Abbreviated month name, based on the locale   Jan through Dec
%Y   Four digit representation for the year   Example: 2038

http://php.net/manual/en/function.strftime.php


this was posted elsewhere, reposting it here for you.

Thank you! It works :)

One more question: if the article is posted today or yesterday, the portal shows "Today 11:50 pm" for example. Can I change it to 24H format? So I want to see "Today 23:50". What I have to change for this?

Thank you!
Title: Re: Category style and date format change
Post by: illori on November 22, 2015, 01:29:38 PM
since it does not use SMF format, i dont think today/yesterday is possible.
Title: Re: Category style and date format change
Post by: zsolteey on November 22, 2015, 01:46:56 PM
Quote from: illori on November 22, 2015, 01:29:38 PM
since it does not use SMF format, i dont think today/yesterday is possible.

Yesterday/today is works fine, just the 24 H format was my question. But I hope I find it.
In TPsubs.template.php I changed this code:

$h = strpos($format, '%l') === false ? [b]'%I' [/b]: '%l';
$today_fmt = $h . ':%M' . $s [b]. ' %p';[/b]


to this:

$h = strpos($format, '%l') === false ? '%H' : '%l';
         $today_fmt = $h . ':%M' . $s . ' ' /*. ' %p'*/;

and now it's looking good :)

Can you answer to my first question in the starter question?
What's the simplest way to change the categories apperance?
Title: Re: Category style and date format change
Post by: WillyP on November 22, 2015, 02:55:54 PM
Can you clarify that question? What is it you want to change? And what do you want it changed to?
Title: Re: Category style and date format change
Post by: zsolteey on November 22, 2015, 10:47:33 PM
Quote from: WillyP on November 22, 2015, 02:55:54 PM
Can you clarify that question? What is it you want to change? And what do you want it changed to?

Okkay, I try to clarify.

I attached a screenshot (style.png). (It's a hungarian forum.)
I have a category named "Partners". In this partners category I have an article named "www.oninditogenerator.hu akció". I selected this partners category on my site and I can see my article.

As you can see the left and right block stlye is different.

The left side ("Hírek") is an "article in a category" block. If I open this block property there is option to change the style of the block. It's name "Choose style for the block:" and I selected "catbg+windowbg".

If I open the "Partners" category settings (categorysettings.png) I can't choose style. I just can rewrite manually by code when I select the "Use custom template". Are there any easier method? Can I choose the style as I can select in a block settings?

Title: Re: Category style and date format change
Post by: WillyP on November 24, 2015, 12:41:57 AM
So as I understand it, you want all categories in a block to have one style, except for the category called 'Partners' which gets a different style? But, none of the layouts given suit your needs?

If that is correct, I would think using a custom template would give you what you want.
Title: Re: Category style and date format change
Post by: zsolteey on November 24, 2015, 08:10:24 AM
Quote from: WillyP on November 24, 2015, 12:41:57 AM
So as I understand it, you want all categories in a block to have one style, except for the category called 'Partners' which gets a different style?

If that is correct, I would think using a custom template would give you what you want.

Okay, I solved it with custom template.
Thank you.
Title: Re: Category style and date format change
Post by: Ken. on November 24, 2015, 10:32:44 AM
Quote from: zsolteey on November 24, 2015, 08:10:24 AM
Quote from: WillyP on November 24, 2015, 12:41:57 AM
So as I understand it, you want all categories in a block to have one style, except for the category called 'Partners' which gets a different style?

If that is correct, I would think using a custom template would give you what you want.

Okay, I solved it with custom template.
Thank you.

Good work zsolteey!  O0

And... Good tip Willy!  O0

Marked Solved.