We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42101
    • 125 Posts
    Hi!

    How could I built a button for "publish" and "unpublish" migx items?
    Example: When I have an item but I dont want to have it public after adding it to the list, but want to just work on it in the backend and later publish it - or being able to "unbpublish" an item. Something like a hidden option....

    Thank you very much!

    AD
      • 4172
      • 5,888 Posts
      add a new field 'published' with
      inputTVtype: listbox
      inputOptionValues: yes==1||no==0

      in the getImageList - snippet - call add:

      &where=`{"published:=":"1"}`
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 42101
        • 125 Posts
        superb! thank you very much bruno!
        It works!
        one question left:


        [[!getImageList?
            &tvname=`demo`
            &docid=`[[+id]]`
            &tpl=`demo_item`
            &where=`{"published:=":"1"}`
             ]]


         <li class="span[[+span]] ">
        <div class="thumbnail"> <img src="[[+image:phpthumbof=`w=[[+imagewidth]]&h=0&zc=0`]]" title="[[+desc:htmlentities]]" /> [[+embedded]] 
        <h4>[[+title]]</h4>
        <p>[[+desc]]</p>
        </div>
        </li>  


        If I check no, on the frontend an empty "demo_item" template is shown empty


        </li>   <li class="span ">
        <div class="thumbnail"> <img src="" title="" />  
        <h4></h4>
        <p></p>
        </div>
        </li> 


        where normally the item values would appear. What could I do?

        Alsoe when all items are "unpublished" the demo_item tpl is rendered to html for one time...

        thanks
        ad

        --edit: strangly after changing
        &where=`{"published:=":"1"}`
             ]]
        into
        &where=`{"published:=":"0"}`
             ]] 
        and
        "inputOptionValues":"yes==0||no==1"}
        into
        "inputOptionValues":"yes==1||no==0"}
        it works now.

        thanks,
        ad [ed. note: ad2003 last edited this post 13 years, 6 months ago.]