Turn h2 into h3 when items are showing inside a category blog?

More
9 years 9 months ago #57456 by flodariege
Hi,

I wonder if it would be possible, using a little of php, to turn the h2 headings of items into h3 when the items are showing into a category blog ...

This is why I'm asking:
I managed to get h1 titles on my items, and it's great because flexicontent has something that turn them into h2 when the items are displayed into a category blog.
This way, I still have only ONE h1 per page. (into the category_items.php, there is a contentheading between h2 tags)

But for each of my items, I don't have any h2.
Title is h1, then the following heading is a h3.
I would like to change this, in order to avoid "holes" in hierarchy, but if I do so, then when the items are displayed into a category blog, I will have 2 h2 titlles for each items, which is obviously not good.

Is there a way to write something into the php to change the h2 into h3 ?
Any idea ?

Thanks.
Flo

PS: I'm not a php pro, but I'm a good little monkey able to reproduce a trick if someone shows me how to do it.

Dare to dream, believe the unbelievable, never take no for an answer

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #57466 by micker
you can use rereplacer component it think

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago - 9 years 9 months ago #57471 by flodariege
Pardon, voisin toulousain, mais ce n'est pas tout à fait ce que je demandais.
Je ne veux pas "vraiment" changer mes h2 en h3.
Je voudrais juste que lorsque l'article s'affiche en blog de catégorie, les h2 soient "transformés" en h3.

Imagine : j'ai des articles dont le titre est en h1 + un sous-titre en h2.
Avec le template blog, quand cet article s'affiche dans un blog de catégorie, le titre en h1 devient un h2 (tant mieux, comme ça on conserve un seul h1 par page).
Ce petit tour de magie est réalisé par quelques lignes de php dans category_items.php

... mais le sous-titre en h2, lui, reste un sous-sitre en h2 : du coup, chaque article dans la page du blog de catégorie commence par 2 titres en h2.
Je cherche donc le moyen de reproduire un peu ce qui se passe avec le titre : je voudrais écrire des lignes de commande php (que malheureusement je ne maîtrise pas), pour dire : dans le template blog, les sous-titres h2 (éventuellement en leur donnant une classe particulière) sont encadrés par des balises h3

Voici ce qui se passe avec les titres des articles dans le template blog :
Code:
<?php if ($this->params->get('show_title', 1)) : ?> <h2 class="contentheading"><span class="fc_item_title"> <?php if ($this->params->get('link_titles', 0)) : ?> <a href="<?php echo $link_url; ?>"><?php echo $item->title; ?></a> <?php else : echo $item->title; endif; ?> </span></h2> <?php endif; ?>

C'est ça que j'aimerais reproduire pour les sous-titres, mais si j'arrive à comprendre à peu près ce que dit le php, je suis bien incapable de l'écrire moi même...

Une idée ?

Merci ;)
Flo, d'Ariège
--

Sorry, but this is not what I was asking.
I only want to change the Hn level when items are showing inside a category blog

Imagine an article with one h1, one h2, and several h3, hn...
When this article is displayed as an article, everything is OK.

BUT: inside a category blog, the page contains : one h1 (title of the category), and for each article on the page : two h2 (because the h1 title of the article turns to be a h2 with the category blog template)

Dare to dream, believe the unbelievable, never take no for an answer
Last edit: 9 years 9 months ago by flodariege.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.614 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save