Most recent edit on 2005-10-22 15:49:20 by BumaThan
Additions:
This function displays the content of your article. You're gonna add some html comments at the start and the end of it. They'll be selected by the eregi function.
Deletions:
This function displays the content of your article. You're gonna add some html comments at the start and the end of it. They'll be recognized by the eregi function.
Edited on 2005-10-22 15:48:45 by BumaThan
Additions:
Maybe you want to display the whole or a part of the last content published on your homepage for example. You have to add a function. This one has been called pxLastResContent and was created by Seb, asked to by Buma.
You need to edit four files, but don't worry, it's very easy...
Here, we've used an eregi function that selects a part of the text.
Dans le fichier, resource_articles.php, retrouvez. Open resource_articles.php and look for this lines...
This function displays the content of your article. You're gonna add some html comments at the start and the end of it. They'll be recognized by the eregi function.
A usual, when you add a function to PLume, you create a my.functions.php file if don't have already one. You'll save it in the 'frontinc' directory wwith the other functions.php file.
Now, you add these lines, the new function.
Now, you have to edit the functions.php file and replace the pxLastResPath function with this one.
Save the files.
Ouvrez le fichier prepend.php , toujours dans le même répertoire (/manager/frontinc/prepend.php) et on y ajoute un lien pour mentioner notre fichier my.functions.php
Open prepend.php, in the same directory and add a link to mention your my.function.php file, like this.
Everything is ready. You just have to add these two lines in your loop, where you want to display the content of the last article published on your website...
This function will surely be added to Plume 1.2. Thank you Seb.
Deletions:
Dans le fichier, resource_articles.php, retrouvez
OUvrez le fichier prepend.php , toujours dans le même répertoire (/manager/frontinc/prepend.php) et on y ajoute un lien pour mentioner notre fichier my.functions.php
Edited on 2005-10-22 13:59:58 by BumaThan
Additions:
Il va vous falloir éditer au total, quatre fichiers, mais rassurez-vous, rien de compliqué...
Deletions:
Il va vous falloir éditer au total, trois fichiers, mais rassurez-vous, rien de compliqué...
Oldest known version of this page was edited on 2005-10-22 13:59:15 by BumaThan []
Page view:
Afficher le contenu du dernier article
Pour telle ou telle raison, vous pouvez avoir besoin d'afficher le contenu intégral ou non du dernier article, sur votre première page par exemple. Il vous faut alors ajouter une fonction. Cette fonction a été nommé pxLastResContent; elle a été proposéé par Seb à la demande de Buma.
Il va vous falloir éditer au total, trois fichiers, mais rassurez-vous, rien de compliqué...
Première étape
Nous avons ici utilisé une fonction PHP qui va sélectionner une partie précise du texte, c'est la fonction "eregi"
, elle est insensible à la casse, mais je vous conseille de respecter les instructions indiquées.
Dans le fichier, resource_articles.php, retrouvez
<?php pxArtPageContent(); ?>
Cette fonction Plume correspond à l'affichage du contenu de votre article. Vous allez l'entourer de commentaire html qui seront reconnu par la fonction eregi dont on a parlé plus haut...
<!--debutdutexte-->
<?php pxArtPageContent(); ?>
<!--findutexte-->
Voilà qui est fait pour le fichier resource_article.php
Deuxième étape
Comme d'habitude lorsque vous ajouter une fonction à Plume, vous allez créer un fichier my.functions.php si vous n'en possèdez pas déjà un. Vous l'enregistrerez plus tard dans le répoertoire 'Frontinc' où se trouve functions.php
Mais auparavant, vous allez y ajouter ces lignes de code, la nouvelle fonction en question.
function pxLastResContent
($url) {
//lecture du contenu du fichier
$content =
file_get_contents($url,
"r");
//on isole la selection
$selection =
eregi ('<!--debutdutexte-->(.*)<!--findutexte-->',
$content,
$regs);
//on affiche le texte selectionné
echo $regs[1];
}
Vous devez maintentant modifier le fichier functions.php et plus précisement, remplacer le fonction pxLastResPath par celle-ci
function pxLastResPath
($type =
'relative',
$return=
false)
{
global $_PX_website_config,
$_PX_config;
$s =
($_PX_website_config['secure']) ?
's' :
'';
switch ($type) {
case 'full' :
$path =
'http'.
$s.
'://'.
$_PX_website_config['domain'].
$_PX_website_config['rel_url'];
break;
default :
$path =
$_PX_website_config['rel_url'];
break;
}
if ($_PX_config['url_format'] ==
'simple') {
$path .=
'/?';
}
$path .=
$GLOBALS['_PX_render']['m']->
lres->
getPath();
if ($return) return $path;
echo $path;
}
Enregistrez évidemment les deux fichiers et l'on finalise maintenant nos modifications...
Troisième étape
OUvrez le fichier prepend.php , toujours dans le même répertoire (/manager/frontinc/prepend.php) et on y ajoute un lien pour mentioner notre fichier my.functions.php
include_once $_PX_config['manager_path'].'/frontinc/functions.php';
Sous les autres...
Dernière étape
Théoriquement, tout est en place, vous n'avez plus qu'à appeler la fonction à l'endroit souhaitez avec ces deux lignes que vous intègrez dans votre boucle Last habituelle...
<?php $url = pxLastResPath('full', true);
pxLastResContent($url);?>
Merci encore à Seb pour cette nouvelle fonction qui sera sûrement intègrée dans Plume 1.2