We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16278
    • 928 Posts
    This is an auto-generated topic for PubKit 0.7.1-beta by kp52.

    Brief Description:

    This is the first version submitted to the Extras. It adds the installer, and fixes some minor bugs as detailed in the changelog.
      • 22427
      • 793 Posts
      Hello kp52,
      when in my News section I set the Input Type of the TV defining the available tags to Check Box instead of Radio Options and Add/Edit a news item, the following Parse Error appears after clicking Publish or Preview:
      PHP error debug
        Error: 	Illegal offset type	 
        Error type/ Nr.: 	Warning - 2	 
        File: 	C:\xampp\htdocs\.....\assets\snippets\pubKit\pubKit.inc.php	 
        Line: 	422	 
        Line 422 source: 	$landing = $modx->makeUrl($postid[$fields['tags']]);

      Looks like a problem with $postid.
      Any hints?
      Many thanks
      ottogal
        • 16278
        • 928 Posts
        In the sample call, &postid is a comma-separated list of pages to show after posting, relating the tag chosen to the landing page.
        &postid=`pupils 153,staff 154,parents 155` 

        If you’re using a checkbox, its output is an array rather than a single value, so you can only have a single landing page, not a list. If two boxes are ticked, you can’t go to two places at once.
        &postid=`150` 

        smiley KP
          • 22427
          • 793 Posts
          Ah, that’s really kind of obvious! rolleyes

          But when I assign more than one tag to an item, it wouldn’t show up in neither of the lists filtered by one of these tags. Obviously the tags are conjuncted by ADD instead of OR.
          I tried to use the Ditto parameter [tt]&tagMode=`onlyTags`[/tt] which changed nothing (obviuosly, that is the default value).
            • 16278
            • 928 Posts
            Selection by tags works for me, looking from both ends. That is, an item with two tags is selected when one is set in &tags, and an item with one tag is selected when the tag is one in a list in &tags. You can experiment a bit with the cirteria set in the URL on the Pogwatch tagging example page - click on a tag under an item headline to pick out any items with that tag, play around with the &tags=X (e.g. &tags=Arts,Politics) in the URL to check out alternatives.

            What does your Ditto call look like, and how is the tagging TV defined, particularly with regard to its delimiter?
            smiley KP
              • 22427
              • 793 Posts
              My structure is
              News  (2)
              |__News of Category 1  (23)
              |__News of Category 2  (24)
              News Store  (17)
              
              The Ditto call in [tt]News of Category 1[/tt] is
              [!Ditto? &parents=`17` &tagData=`NewsTags` &tags=`newscat1` &config =`pkNews` &orderBy=`pkDate DESC,menuindex DESC`!]

              The TV [tt]NewsTags[/tt] has the [tt]Input Option Values[/tt]
              News category 1==newscat1||News category 2==newscat2

              and uses the widget [tt]Delimited List[/tt] with comma as [tt]Delimiter[/tt].

              I played around with the tags parameter in the URL - all works fine:
              With [tt]?tags=newscat1,newscat2[/tt] all news are displayed having category 1 OR category 2.

              Edit:
              Sorry for the confusion: It didn’t work with the URL parameter as well.

              In any case, trying to get all news tagged [tt]newscat1[/tt] But when I click a link to the sub page (ID=23) for [tt]category 1[/tt], the listing contains only those news tagged [tt]newscat1[/tt] alone, not the ones with the additional tag [tt]newscat2[/tt].
                • 22427
                • 793 Posts
                Problem solved: It was a delimiter issue.
                I erraneously thought the delimiter were a comma by default - instead it’s a space.
                So adding [tt]&tagsDelimiter=`,`[/tt] to the Ditto calls helped me out.
                Thank you, kp52, for the nudge into the delimiter direction.
                  • 18381
                  • 3 Posts
                  Hi! Thanks for this snippet, it’s working perfectly for me using a custom class and I couldn’t be happier. However I’m a little out of my depth here so If you could point me in the right direction i’d really appreciate it.

                  I have the tags working for a TV that I’ve made - no issues there. But how would I go about / is it possible to have multiple TVs that act as tags? E.g. Favourite colour, Favourite shape?

                  Many Thanks in advance - and while I’m at it: your Ditto reference is probably one of the most useful resources available. My sincerest thanks for the time and effort that must have gone into it. grin
                    • 16278
                    • 928 Posts
                    <blush>Thanks for the feedback!</blush>

                    I’ve started looking at multiple tag sets, and it’s going well. I think it’s possible to handle them without major revision of the core code, where the standard single tag set gets special treatment. I’ve tried setting the relevant placeholder in the item’s class definition, and just had to add a test to avoid overwriting it with the value returned from the form field when an error is detected. Now I’m looking at recreating the existing selections on re-edit or return from the preview.

                    More to follow soon!
                    laugh KP
                      • 18381
                      • 3 Posts
                      Yipee-kai-hey! Don’t mention it - the thanks is well deserved. Cheers for the reply i’ll keep watching this space.