We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31662
    • 10 Posts
    Hi, I’m new to the forum and I wish to thank everyone for the informations I’ve read in the past months. I’ve managed to port my site completely to modx revo in a localhost, but I’m having issues with the blog setup.

    I’ve followed the tutorial http://rtfm.modx.com/display/revolution20/Creating+a+Blog+in+MODx+Revolution and I understand all the parts, but still it’s not working for me. I think there’s something wrong in my setup. I’ll try to post everything so that maybe someone can find the problem, I haven’t found any working solution for me in the forum. Sorry for the long post.

    My MainTemplate:
    [[$site_header]]
    [[*content]]
    [[$site_footer]]​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​


    my Blog page, ID 14 (using MainTemplate):
    [[!getResourcesTag?
      &elementClass=`modSnippet`
      &element=`getResources`
      &tpl=`blogPost`
      &parents=`11`
      &limit=`5`
      &includeContent=`1`
      &includeTVs=`1`
      &showHidden=`0`
      &hideContainers=`1`
      &cache=`0`
      &pageVarKey=`page`
    ]]
    [[!+page.nav:notempty=`
    <div class="paging">  
    <ul class="pageList">  
      [[!+page.nav]]  
    </ul>  
    </div>
    `]]
    


    My News category (using MainTemplate)
    [[!getResourcesTag?
    &element=`getResources`
    &elementClass=`modSnippet`
    &tpl=`blogPost`
    &hideContainers=`1`
    &pageVarKey=`page`
    &parents=`[[*id]]`
    &includeTVs=`1`
    &includeContent=`1`
    ]]
    [[!+page.nav:notempty=`
    <div class="paging">
    <ul class="pageList">
    [[!+page.nav]]
    </ul>
    </div>
    `]]
    


    My blogPost chunk:
    <div class="post">
    <h2 class="title"><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h2>
    <p class="post-info">Posted by [[+createdby:userinfo=`fullname`]]
    [[+tv.tags:notempty=` | <span class="tags">Tags:
    [[!tolinks? &items=`[[+tv.tags]]` &key=`tag` &target=`14`]]
    </span>`]]</p>
    <div class="entry">
    <p>[[+introtext]]</p>
    </div>
    <p class="postmeta">
    <span class="links">
    <a href="[[~[[+id]]]]" class="readmore">Read more</a>
    | <span class="date">[[+publishedon:strtotime:date=`%b %d, %Y`]]</span>
    </span>
    </p>
    </div>
    ​


    My BlogPost template, used by the Resources inside the News category:
    UPDATE: I placed an extra [ here, but it was a post error. In my site the call was correct.
    [[$site_header]]
    <div id="content" class="blog-post">
    <h2 class="title"><a href="[[~[[*id]]]]">[[*pagetitle]]</a></h2>
    <p class="post-info">
    Posted on [[*publishedon:strtotime:date=`%b %d, %Y`]] |
    Tags: [[*tags:notempty=`[[!tolinks? &items=`[[*tags]]` &key=`tag` &target=`14`]]`]] |
    </p>
    <div class="entry">
    <p>[[*introtext]]</p>
    <hr />
    [[*content]]
    </div>
    <div class="postmeta">
    [[*tags:notempty=`
    <span class="tags">Tags: [[!tolinks? &items=`[[*tags]]` &key=`tag` &target=`14`]]</span>
    `]]
    <br class="clear" />
    </div>
    <hr />
    </div>
    [[$site_footer]]

    ​
    All the &target options point to my blog home (ID 14).

    Now, whe I load the News page I get a blank page, I only read the content of the [[$site_footer]] over the blank page. In debug, I can confirm no [[$site_header]] loading, but the [[$site_footer]] is there.

    By testing various parts for errors, I tried removing the
    &tpl=`blogPost`
    from my News page, and the page loads normally but without any content. So I think there could be some problem in the call.

    I’m willing to give any informations you need in order to make it work.

    Thanks in advance!
      • 22019
      • 390 Posts
      If you removed the tpl and got no output (as opposed to an array) that means that the getResources call is returning zero rows. Are you sure you’ve got published, not hidden resources under the News page?

      Make sure that News page hasn’t accidentally saved as Rich Text, which screws up the getResources parameters.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 31662
        • 10 Posts
        Thanks for the quick reply. Yes, all the children resources of my News container are published (actually it’s just one example) and my News container and News blog home page are not rich text.
          • 22019
          • 390 Posts
          Other simple things to check - is the resource under News a container (you’ve asked getResourcesTag to hide containers) and it’s not hidden from menus? Also, just because the page isn’t RichText now doesn’t mean that it might not have been at the time you added the getResourcesTag call - check for whether there is ’amp;’ after your ’&’ characters.

          In situations like this I find it best to strip back to basics. Put a second basic getResources call on the News page, with a hardwired &parents. If it outputs an array, then add in the tpl. If it now doesn’t output, then you have an issue with the tpl.
            Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
            • 31662
            • 10 Posts
            Thanks odeclas, we’ve progresses. The resource under news wasn’t a container but was hidden indeed. By toggling the check the resource still is not visible in menus (good, I don’t want each blog post to be visible) but I see content in the Blog Page! I actually see the example post, but without any style, hence, no header. Still it’s a progress! Thanks.
            No amp’s, being used at code pasting it was the first thing I checked.

            So, getResources has output but strips [[$site_header]], suggestions? I’ll check again my code to see if something’s missing or badly written.
              • 31662
              • 10 Posts
              Thanks! Big progresses now. I’ve added a call to the [[$site_header]] and [[$site_footer]] in the blogPost chunk. It works.
              Big thanks odeclas.

              In short: checking that the children resource of my Resource container was visible in menus (Hide frome menus option unchecked) and that the blogPost chunk also contained a call to my standard [[$site_header]] and [[$site_footer]] chunks, solved my issues.

              Now, that could be an edit to add to the tutorial, a sort of checklist for this case.

              Many thanks, that’s by far the best platform, with the best community. Mark as solved.
                • 31662
                • 10 Posts
                A quick update. There’s a but. I’ve two footers now in the main News page, since the first one was already working. Removed the [[$site_footer]] call in the blogPost chunk and everything works. I don’t seem to have two headers.
                  • 31662
                  • 10 Posts
                  Yes, I talked too soon. In fact this way headers and footers are duplicated on every post. It’s the wrong way to go. So, I’ve managed to actually make getResources work, in fact I’ve the correct output, but the [[$site_header]] in the template is completely ignored. The [[$site_footer]] is there. More help needed. I was too excited... :’(
                    • 31662
                    • 10 Posts
                    I’m still trying to follow the blog tutorial, but without success. I assume it’s a fault of my templates setup somehow but without help I’m not able to make it work. To summarize:

                    I’ve a base template with a [[$site_header]] and a [[$site_footer]] chunk. I’ve followed the tutorial to the letter, makeing sure no mispelled &s where placed. It doesn’t work as expected, I have an array output but the page containing the displayed resources is redered wrong because there’s no header in the page. By stripping the part regarding tags, i.e. using getResources instead of getResourcesTag, everything works fine. Could someone please summarize the tutorial to a foolproof list? If it works for everybody then what are the conditions that could make my site different? What is a general and correct template setup for that tutorial?

                    Thanks
                      • 31662
                      • 10 Posts
                      If someone’s out there trying to help, here’s some more insight.

                      The header gets stripped away when using the ! on the getResourcesTag? call.

                      So:
                      !getResourcesTag? outputs an array with working tag navigation and sorting but page style completely broken because the [[$site_header]] call in the template seems to be ignored.

                      getResourcesTag works fine except, of course, no tag sorting is working.

                      Is this helpful?