Jump to content

[BLOC] Bloc informations triées


mudplanet

Recommended Posts

Voici un nouveau bloc modifié par mes soins, le bloc Informations qui affiche les différents articles de CMS.
L'original affiche les liens dans l'ordre des identifiants.
Celui-ci affiche les liens par ordre alphabétique.
Bonus : en ajoutant "1.", "2.", etc. en début de titre, vous pouvez changer l'ordre de tri. Evidemment, cette numérotation n'apparaîtra pas sur l'affichage du bloc.

Installation et administration identiques au bloc standard.

UPDATE : un petit bogue concernant la traduction est corrigé dans cette version 1.12

blockinfos_mp.1.12.zip

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Thanks for contributing this.

It is quite close to what I would like, which is also like to be able to include links in the Information block which point to pages outside of the CMS. There is another block for providing this "Bloc link" but I would like to have a single block combining the two features. For example the information block could include a link to the user's account information.

Is anyone aware of module that would allow for this ?

Regards,
Mark

Link to comment
Share on other sites

A quick hack to allow links to be stored in the CMS

After the line:

$links = CMS::getLinks($cookie->id_lang, $id_cms ? $id_cms : NULL); 



in the file blockinfos_mp.php add the following:

         // Hack to allow links to be provided by the CMS
               reset($links);
               while (list($key, $value) = each($links)) {
         if (preg_match("/^TITLE\s*(.*)\s*URL\s*(.*)/", $value['meta_title'], $matches)) {
           $links[$key]['meta_title'] = $matches[1];
           $links[$key]['link'] = $matches[2];
         }
       }                    



This allows CMS entries with the title like:

TITLE Testing a Link URL my-account.php

To be included in the infoblock as links.

The sitemap.php also needs editing to get the link displayed correctly there. This appears to also be an issue for the numbering system used in this module to order the entries.

In sitemap.php replace the line:

$smarty->assign('cmslinks', CMS::getLinks(intval($cookie->id_lang), $id_cms ? $id_cms : NULL));    



With:

// Hack to allow links to be provided by the CMS
$links = CMS::getLinks($cookie->id_lang, $id_cms ? $id_cms : NULL);
reset($links);
while (list($key, $value) = each($links)) {
 if (preg_match("/^TITLE\s*(.*)\s*URL\s*(.*)/", $value['meta_title'], $matches)) {
   $links[$key]['meta_title'] = $matches[1];
   $links[$key]['link'] = $matches[2];
 }
 if (preg_match("/^\d+\\.\\ *(.*)/", $value['meta_title'], $matches)) {
   $links[$key]['meta_title'] = $matches[1];
 }
$smarty->assign('cmslinks', $links);    




}

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...
  • 2 weeks later...
  • 6 months later...
  • 3 weeks later...
  • 11 months later...

Bonjour,

 

Merci MP pour ce module bien pratique (bien que sur une 1.4.5.1 l'admin ne fonctionne pas trop). Je souhaiterais modifier le code pour qu'il n'affiche que les CMS de la categorie "Accueil" car il affiche tout les CMS (par exemple les toutes les FAQ), or je fais déjà cela dans un autre bloc.

 

Pouvez vous svp me dire comment je peux réaliser cela ?

 

Merci,

 

V.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...