Dotclear

Vous n'êtes pas identifié(e).

Annonce

13 février 2024 Sortie de Dotclear 2.29

#1 2016-11-01 21:54:12

Cassius
Membre
Inscription : 2016-10-26

Comment maintenir un billet en première position

Bonsoir,

Je souhaiterais savoir s'il est possible de maintenir un billet en première position dans l'ordre de lecture du blog, même s'il est très ancien.
Ceci afin d'en faire une sorte de présentation, d'introduction au blog.

A moins qu'il y ait une autre solution...

Cordialement,
Cassius

Hors ligne

#2 2016-11-01 22:41:38

i_love_dc
Membre
Inscription : 2007-07-13

Re : Comment maintenir un billet en première position

(De memoire) la solution c'est d'enregistrer le billet que l'on souhaite voir en premier comme "marquer" ( menu déroulant  a droite ).
Cette option permet d'afficher les billets "marqués ou sélectionnés" toujours en tête de liste ( un post- it).

Hors ligne

#3 2016-11-01 22:53:40

Tomek
Moderator
Inscription : 2006-04-12
Site Web

Re : Comment maintenir un billet en première position

Il y a plusieurs manières de le faire, la plus simple est sans doute d'ajouter une balise entries dans le template home.html dans laquelle tu définis précisément quel billet ou page doit s'afficher en premier.

Pour ce faire, tu dois éditer le template home.html du jeu de template (qui passera du coup dans ton thème). Au départ, dans ce fichier, tu as seulement

{{tpl:extends parent="__layout.html"}}

Il faut que tu ajoutes ceci en-dessous :

<tpl:Block name="main-content">
        <tpl:Entries url="L-url-courte-du-billet-de-presentation"> <!-- début du billet de présentation -->
        <div id="p{{tpl:EntryID}}" class="presentation" lang="{{tpl:EntryLang}}" role="article">
           <h2 class="post-title"><a href="{{tpl:EntryURL}}">{{tpl:EntryTitle encode_html="1"}}</a></h2>
		<p class="post-info">{{tpl:lang By}} {{tpl:EntryAuthorLink}} {{tpl:lang on}} {{tpl:EntryDate}}, {{tpl:EntryTime}}
			<tpl:EntryIf has_category="1">
			- <a href="{{tpl:EntryCategoryURL}}">{{tpl:EntryCategory encode_html="1"}}</a>
			</tpl:EntryIf>
		</p>

		<tpl:EntryTags>
		<tpl:TagsHeader><ul class="post-tags"></tpl:TagsHeader>
		<li><a href="{{tpl:TagURL}}">{{tpl:TagID}}</a></li>
		<tpl:TagsFooter></ul></tpl:TagsFooter>
		</tpl:EntryTags>

		<!-- # --BEHAVIOR-- publicEntryBeforeContent -->
		{{tpl:SysBehavior behavior="publicEntryBeforeContent"}}

		<!-- # Entry with an excerpt -->
		<tpl:EntryIf extended="1">
			<div class="post-content">{{tpl:EntryExcerpt}}</div>
			<p class="read-it"><a href="{{tpl:EntryURL}}"
			title="{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="1"}}">{{tpl:lang Continue
			reading}}</a><span class="readmore-ellipsis">...</span></p>
		</tpl:EntryIf>

		<!-- # Entry without excerpt -->
		<tpl:EntryIf extended="0">
			<div class="post-content">{{tpl:EntryContent}}</div>
		</tpl:EntryIf>

		<!-- # --BEHAVIOR-- publicEntryAfterContent -->
		{{tpl:SysBehavior behavior="publicEntryAfterContent"}}

		<!-- # Number of comments, trackbacks and attachments -->
		<tpl:EntryIf operator="or" show_comments="1" show_pings="1" has_attachment="1">
			<p class="post-info-co">{
		</tpl:EntryIf>
		<tpl:EntryIf show_comments="1">
			<a href="{{tpl:EntryURL}}#comments" class="comment_count">{{tpl:EntryCommentCount}}</a>
		</tpl:EntryIf>
		<tpl:EntryIf show_pings="1">
			<a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:EntryPingCount}}</a></tpl:EntryIf>
		<tpl:EntryIf has_attachment="1">
			<a href="{{tpl:EntryURL}}#attachments" class="attach_count">{{tpl:EntryAttachmentCount}}</a></tpl:EntryIf>
		<tpl:EntryIf operator="or" show_comments="1" show_pings="1" has_attachment="1">
			}</p>
		</tpl:EntryIf>
		</div>
        </tpl:Entries> <!-- fin du billet de présentation -->

	<tpl:Entries> <!-- début de la boucle des billets par défaut -->
	<div id="p{{tpl:EntryID}}" class="post {{tpl:EntryIfOdd}} {{tpl:EntryIfFirst}}" lang="{{tpl:EntryLang}}" role="article">
    <h2 class="post-title"><a href="{{tpl:EntryURL}}">{{tpl:EntryTitle encode_html="1"}}</a></h2>
		<p class="post-info">{{tpl:lang By}} {{tpl:EntryAuthorLink}} {{tpl:lang on}} {{tpl:EntryDate}}, {{tpl:EntryTime}}
			<tpl:EntryIf has_category="1">
			- <a href="{{tpl:EntryCategoryURL}}">{{tpl:EntryCategory encode_html="1"}}</a>
			</tpl:EntryIf>
		</p>

		<tpl:EntryTags>
		<tpl:TagsHeader><ul class="post-tags"></tpl:TagsHeader>
		<li><a href="{{tpl:TagURL}}">{{tpl:TagID}}</a></li>
		<tpl:TagsFooter></ul></tpl:TagsFooter>
		</tpl:EntryTags>

		<!-- # --BEHAVIOR-- publicEntryBeforeContent -->
		{{tpl:SysBehavior behavior="publicEntryBeforeContent"}}

		<!-- # Entry with an excerpt -->
		<tpl:EntryIf extended="1">
			<div class="post-content">{{tpl:EntryExcerpt}}</div>
			<p class="read-it"><a href="{{tpl:EntryURL}}"
			title="{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="1"}}">{{tpl:lang Continue
			reading}}</a><span class="readmore-ellipsis">...</span></p>
		</tpl:EntryIf>

		<!-- # Entry without excerpt -->
		<tpl:EntryIf extended="0">
			<div class="post-content">{{tpl:EntryContent}}</div>
		</tpl:EntryIf>

		<!-- # --BEHAVIOR-- publicEntryAfterContent -->
		{{tpl:SysBehavior behavior="publicEntryAfterContent"}}

		<!-- # Number of comments, trackbacks and attachments -->
		<tpl:EntryIf operator="or" show_comments="1" show_pings="1" has_attachment="1">
			<p class="post-info-co">{
		</tpl:EntryIf>
		<tpl:EntryIf show_comments="1">
			<a href="{{tpl:EntryURL}}#comments" class="comment_count">{{tpl:EntryCommentCount}}</a>
		</tpl:EntryIf>
		<tpl:EntryIf show_pings="1">
			<a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:EntryPingCount}}</a></tpl:EntryIf>
		<tpl:EntryIf has_attachment="1">
			<a href="{{tpl:EntryURL}}#attachments" class="attach_count">{{tpl:EntryAttachmentCount}}</a></tpl:EntryIf>
		<tpl:EntryIf operator="or" show_comments="1" show_pings="1" has_attachment="1">
			}</p>
		</tpl:EntryIf>
		</div>

		<tpl:EntriesFooter>
			<tpl:Pagination>
				<p class="pagination"><tpl:PaginationIf end="0"><a href="{{tpl:PaginationURL offset="+1"}}" class="prev">&#171;
				{{tpl:lang previous entries}}</a> - </tpl:PaginationIf>
				{{tpl:lang page}} {{tpl:PaginationCurrent}} {{tpl:lang of}} {{tpl:PaginationCounter}}
				<tpl:PaginationIf start="0"> - <a href="{{tpl:PaginationURL offset="-1"}}" class="next">{{tpl:lang next entries}}
				&#187;</a></tpl:PaginationIf></p>
			</tpl:Pagination>
		</tpl:EntriesFooter>
	</tpl:Entries>
</tpl:Block>	<!-- main-content -->

Pour découvrir comment tout ça fonctionne, je te laisse parcourir la documentation, notamment cette page : https://fr.dotclear.org/documentation/2 … gs/entries, mais aussi la page de présentation : https://fr.dotclear.org/documentation/2 … ces/themes

Si tu utilises une page au lieu d'un billet, tu dois le préciser dans la balise ouvrante : <entries url="l-url-de-ta-page" type="page">

J'ai mis une classe "presentation" pour ton billet/page d'intro, comme ça tu pourras le styler différemment si tu le souhaites, mais tu peux tout à fait changer ce nom, ou ne pas le styler.

Hors ligne

#4 2016-11-01 22:59:15

Tomek
Moderator
Inscription : 2006-04-12
Site Web

Re : Comment maintenir un billet en première position

i_love_dc a écrit :

(De memoire) la solution c'est d'enregistrer le billet que l'on souhaite voir en premier comme "marquer" ( menu déroulant  a droite ).
Cette option permet d'afficher les billets "marqués ou sélectionnés" toujours en tête de liste ( un post- it).

Alors par tout à fait : il y a une case à cocher "billet sélectionné". Une fois que c'est fait, il faut tout de même ajouter un tri sur la boucle entries dans le fichier home.html (sortby="selected"). Si c'est le seul billet sélectionné, il s'affichera en tête.

Hors ligne

#5 2016-12-28 17:38:08

eroux8371
Membre
Inscription : 2016-12-28

Re : Comment maintenir un billet en première position

Merci pour toutes ces informations, je commençais à désespérer de réussir à le faire sur un forum que je tiens. Merci encore, maintenant ça marche parfaitement!

Hors ligne

#6 2016-12-28 23:46:05

Tomek
Moderator
Inscription : 2006-04-12
Site Web

Re : Comment maintenir un billet en première position

C'est trop d'honneur, mais ça ne fonctionne pas sur un forum, espèce de spammeur indélicat : lien commercial supprimé (Caramba, encore raté).

Hors ligne

Vous n'êtes pas identifié(e).

Pied de page des forums

Sites map