We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    On AjaxSearch and FlexSearchForm, as well as other search snippets sometimes the search returns a page which has a "blank" template. So, when you click on the search results you get a blank page with the content on it.

    What I’d like to know/do is:

    + If the page template is blank, (blank) or 0 then go up the chain until you find a parent that has a non-blank template
    + Return the non-blank template ID
    + Use this as the document link

    Or, if its been solved another way, that’d be great!
      • 7231
      • 4,205 Posts
      Maybe add a redirect snippet to redirect to parent. there is a snippet in the repository named phiRedict (or something like that) that has some nice redirect features.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 32645
        • 377 Posts
        Thanks.

        i will take a look.

        UPDATE:

        That worked perfectly! I’ve spent ages trying to hack my way around it, and there was already a solution out there!!

        REF:
        http://www.modxcms.com/phiRedirect-1537.html
          • 27376
          • 576 Posts
          I usually make my MODx folders weblinks that link to the parent document or first child document. I haven’t tested how the behavior works with Search snippets as I use Google Custom Search but weblinks behave just like HTTP 301 Redirects so it shouldn’t be a problem.

          Attached is a sample of the hierarchy of one of my sites showing sort of what I mean (document 103 is a weblink to document 6).
            • 32645
            • 377 Posts
            That’s another good solution too. However, if you’re children are sitting in blank templates (usually used as Ditto templates) then you still have the same problem.
              • 7231
              • 4,205 Posts
              I like that idea to, the results are the same but the interface is a bit more straight forward.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]