TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 07:42:35 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 129
  • Total: 129

Category style and date format change

Started by zsolteey, November 22, 2015, 12:19:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zsolteey

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.

illori

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.

zsolteey

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!

illori

since it does not use SMF format, i dont think today/yesterday is possible.

zsolteey

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?

WillyP

Can you clarify that question? What is it you want to change? And what do you want it changed to?

zsolteey

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?


WillyP

#7
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.

zsolteey

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.

Ken.

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.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.