Fork me on GitHub

News question  Bottom

  • Hi there!

    I have a category named "shortnews" it only contains a title nothing else, but i want it to be shown up in the archives with just the title, no link to the article, so i tried this:

    Code

    <!--[if $preformat.maintext neq '']-->
    <a href="<!--[pnmodurl modname="News" type="user" func="display" sid=$archiveitems[items].sid|pnvarprepfordisplay]-->"><!--[$archiveitems[items].title|pnvarprepfordisplay]--></a>
           
    <!--[else]-->

    <!--[$archiveitems[items].title|pnvarprepfordisplay]-->
    <!--[/if]-->

    but this doesn`t work...
    does anybody has an idea?
    thanks!

    --
    Newsletter Project


    Visit the german speaking community!
  • I would recommend to check the loaded data with <--[pndebug]-->

    You need to check a specific category ID instead an empty maintext, or strip the tags of the maintext and trim it, it may work, but it's not the better way IMHO. So, you should check if the __CATEGORIES__ field of the article is set, and check the Main category ID, something like:

    Code

    <!--[if isset($archiveitems[items].__CATEGORIES__.Main) AND $archiveitems[items].__CATEGORIES__.Main.id eq shortnewsID]-->

    <!--[$archiveitems[items].title|pnvarprepfordisplay]-->
           
    <!--[else]-->

    <a href="<!--[pnmodurl modname="News" type="user" func="display" sid=$archiveitems[items].sid|pnvarprepfordisplay]-->"><!--[$archiveitems[items].title|pnvarprepfordisplay]--></a>

    <!--[/if]-->
    Changing the shortnewsID to the numeric value of your category.

    A minor mistake here, is that $preformat is not loaded in the archives.
    Only the $archiveitems is loaded with the array of articles with non-processed data (only "$info" not $links nor $preformat), that's why it's recommended to use pndebug icon_wink

    Greetings

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Hi Mateo!
    thanks! It works! i used pndebug and tried different things also categorys, but this didn`t work (with my code icon_biggrin )...
    greetings Dominik

    --
    Newsletter Project


    Visit the german speaking community!
  • Can you post your code so others may benefit if they do the same thing?
  • As i wrote above, Mateo`s code works. icon_wink

    --
    Newsletter Project


    Visit the german speaking community!

This list is based on users active over the last 60 minutes.