We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4882
    • 44 Posts
    Hi All
    I’m a complete beginner to Modx and blogs. I’m following the Creating a Blog in MODx Revolution tutorial, but I cannot get it to work. Any assistance would be appreciated
    1. I downloaded getResources,getPage, Quip tagLister ,Archivist.
    2. Attached is an image of my resources structure.
    3. I created a template called ’BlogPostTemplate’ and put the following content in:
    [[$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=``]]`]] |
    <a href="[[~[[*id]]]]#comments" class="comments">
    Comments ([[!QuipCount? &thread=`blog-post-[[*id]]`]])
    </a>
    </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=`2`]]</span>
    `]]
    <br class="clear" />
    </div>
    <hr />
    <div class="post-comments" id="comments">[[!Quip?
    &thread=`blog-post-[[*id]]`
    &replyResourceId=`10`
    &closeAfter=`30`
    ]]



    [[!QuipReply?
    &thread=`blog-post-[[*id]]`
    &notifyEmails=`[email protected]`
    &moderate=`1`
    &moderatorGroup=`Moderators`
    &closeAfter=`30`
    ]]
    </div>
    </div>
    </div>
    <div class="spacer"></div>
    </div>
    [[$footer]]
    </div>
    4. Created a TV called ‘tags’. It has access to the ’BlogPostTemplate’ Template.
    5. I created my resource sections "Personal" ID 5 and "Technology" ID 6 and made them containers, with a base template. And put the following content in:
    [[!getResourcesTag?
    &element=`getResources`
    &elementClass=`modSnippet`
    &tpl=`blogPost`
    &hideContainers=`1`
    &pageVarKey=`page`
    &parents=`[[*id]]`
    &includeTVs=`2`
    &includeContent=`1`
    ]]
    [[!+page.nav:notempty=`
    <div class="paging">
    <ul class="pageList">
    [[!+page.nav]]
    </ul>
    </div>
    `]]
    6. I made my blogPost Chunk, with the following code.
    <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=`1`]]
    </span>`]]</p>
    <div class="entry">
    <p>[[+introtext]]</p>
    </div>
    <p class="postmeta">
    <span class="links">
    <a href="[[~[[+id]]]]" class="readmore">Read more</a>
    | <a href="[[~[[+id]]]]#comments" class="comments">
    Comments ([[!QuipCount? &thread=`blog-post-[[+id]]`]])
    </a>
    | <span class="date">[[+publishedon:strtotime:date=`%b %d, %Y`]]</span>
    </span>
    </p>
    </div>
    7. I created my home page for the blog, which i’ve got in Resource ID 13 (called blog). I put the following code in the resource content:
    [[!getResourcesTag?
    &elementClass=`modSnippet`
    &element=`getResources`
    &tpl=`blogPost`
    &parents=`5,6`
    &limit=`5`
    &includeContent=`1`
    &includeTVs=`2`
    &showHidden=`0`
    &hideContainers=`1`
    &cache=`0`
    &pageVarKey=`page`
    ]]
    [[!+page.nav:notempty=`
    <div class="paging">
    <ul class="pageList">
    [[!+page.nav]]
    </ul>
    </div>
    `]]
    8. Inside my Personal container , I have created a new blog resource called ‘Events’ and set it’s Template to ’BlogPostTemplate’.
    9. Lastly, I’ve specified the tag.

    If I click on the events page I can preview my blog. But on my Blog page, icannot see any posts

    Please can somebody help, ive redone this tutorial several times, and I’m not sure what’s wrong.

    Many thanks
    Rob


      • 22019
      • 390 Posts
      Rob - I’m just tidying up your post and putting all your code in ’code’ tags first, so that it’s easier to reply - in a minute. To format as code select your text and use the button with the hash/pound key on it.

      Quote from: cfdm at Dec 17, 2010, 02:51 PM

      Hi All
      I’m a complete beginner to Modx and blogs. I’m following the Creating a Blog in MODx Revolution tutorial, but I cannot get it to work. Any assistance would be appreciated
      1. I downloaded getResources,getPage, Quip tagLister ,Archivist.
      2. Attached is an image of my resources structure.
      3. I created a template called ’BlogPostTemplate’ and put the following content in:
      [[$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=``]]`]] | 
      <a href="[[~[[*id]]]]#comments" class="comments">
      Comments ([[!QuipCount? &thread=`blog-post-[[*id]]`]])
      </a>
      </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=`2`]]</span>
      `]]
      <br class="clear" />
      </div>
      <hr />
      <div class="post-comments" id="comments">[[!Quip?
      &thread=`blog-post-[[*id]]`
      &replyResourceId=`10`
      &closeAfter=`30`
      ]]
      <br /><br />
      [[!QuipReply?
      &thread=`blog-post-[[*id]]`
      &notifyEmails=`[email protected]`
      &moderate=`1`
      &moderatorGroup=`Moderators`
      &closeAfter=`30`
      ]]
      </div>
      </div>
      </div>
      <div class="spacer"></div>
      </div>
      [[$footer]] 
      </div>
      

      4. Created a TV called ‘tags’. It has access to the ’BlogPostTemplate’ Template.
      5. I created my resource sections "Personal" ID 5 and "Technology" ID 6 and made them containers, with a base template. And put the following content i

      [[!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>
      `]]
      

      6. I made my blogPost Chunk, with the following code.
      <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=`1`]]
      </span>`]]</p>
          <div class="entry">
      	<p>[[+introtext]]</p>
          </div>
          <p class="postmeta">
            <span class="links">
      <a href="[[~[[+id]]]]" class="readmore">Read more</a>
      | <a href="[[~[[+id]]]]#comments" class="comments">
          Comments ([[!QuipCount? &thread=`blog-post-[[+id]]`]])
        </a>
      | <span class="date">[[+publishedon:strtotime:date=`%b %d, %Y`]]</span>
            </span>
          </p>
      </div>
      

      7. I created my home page for the blog, which i’ve got in Resource ID 13 (called blog). I put the following code in the resource content:
       [[!getResourcesTag?
        &elementClass=`modSnippet`
        &element=`getResources`
        &tpl=`blogPost`
        &parents=`5,6`
        &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>
      `]]
      

      8. Inside my Personal container , I have created a new blog resource called ‘Events’ and set it’s Template to ’BlogPostTemplate’.
      9. Lastly, I’ve specified the tag.

      If I click on the events page I can preview my blog. But on my Blog page, icannot see any posts

      Please can somebody help, ive redone this tutorial several times, and I’m not sure what’s wrong.

      Many thanks
      Rob



        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 4882
        • 44 Posts
        Thanks for tidying up my code - it was rather messy. I see the # now.
          • 22019
          • 390 Posts
          Ok - that didn’t help me much, but never mind.

          In 3 you will need to change the quip email address, but that’s not an issue right now.

          In 5 and 7 make sure you’ve set &includeTVs=`1` (not = 2 as you had it).

          So, to summarise, you’re expecting resource id 13 (blog) to list id 12 (Events, under the container ’personal’ of id 5? Are both containers published? It looks like both 5 and 6 are unpublished. I’m pretty sure that getResources won’t list children of unpublished parents.



            Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
            • 4882
            • 44 Posts
            That’s correct.

            i’ve set &includeTVs=`1`.

            ID 13 (blog) is still not displaying any blogs, although i’ve published id 5 and id 6 (the containers).
              • 22019
              • 390 Posts
              Checking back to your screenshots, it’s outputting the ’music’ tag, so it must have found something - check that the tpl=`blogPost` that you have used in the getResources call on your blog home is the same name as the chunk you created earlier - as that’s the bit that’s not outputting.

              You’ll also need to tidy where the tags link to (&target) - presumably id 13.
                Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                • 4882
                • 44 Posts
                I’ve checked that the tpl=`blogPost` is correct. I’m really struggling here. I’ve updated some of the code below, i don’t know if it will be helpful.

                Thanks once again for your help so far, much appreciated.

                PAGES


                Blog [13]
                Template: BlogPostTemplate
                TV: music
                 [[!getResourcesTag?
                  &elementClass=`modSnippet`
                  &element=`getResources`
                  &tpl=`blogPost`
                  &parents=`5,6`
                  &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>
                `]]


                Personal [5] - container
                Template: insidePage
                No TV

                [[!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>
                `]]


                Events [12]– blog article
                Template: BlogPostTemplate
                TV: apple
                Parent Resource: personal (5)

                General content

                TEMPLATES

                BlogPostTemplate

                [[$header]] 
                <a href="#" accesskey="2" class="skip">skip</a>
                
                <div id="header">
                    <img src="assets/images/logo.png" width="400" height="97" alt="Family Funk" class="logo"/>
                    <div id="menu">
                      [[!Wayfinder? &startId=`0`]]
                      <div class="spacer"></div>
                    </div>
                    <div class="spacer"></div>
                
                </div>
                
                <div id="main">
                
                <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=`13`]]`]] | 
                  <a href="[[~[[*id]]]]#comments" class="comments">
                    Comments ([[!QuipCount? &thread=`blog-post-[[*id]]`]])
                  </a>
                  </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=`13`]]</span>
                    `]]
                    <br class="clear" />
                  </div>
                  <hr />
                  <div class="post-comments" id="comments">[[!Quip?
                      &thread=`blog-post-[[*id]]`
                      &replyResourceId=`10`
                      &closeAfter=`30`
                    ]]
                    <br /><br />
                    [[!QuipReply?
                       &thread=`blog-post-[[*id]]`
                       &notifyEmails=`[email protected]`
                       &moderate=`1`
                       &moderatorGroup=`Moderators`
                       &closeAfter=`30`
                    ]]
                  </div>
                </div>
                	</div>
                <div class="spacer"></div>
                </div>
                [[$footer]] 
                </div>
                


                Tags (2)
                Uses BlogPostTemplate

                Chunks
                blogPost

                <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=`1`]]
                </span>`]]</p>
                    <div class="entry">
                	<p>[[+introtext]]</p>
                    </div>
                    <p class="postmeta">
                      <span class="links">
                <a href="[[~[[+id]]]]" class="readmore">Read more</a>
                | <a href="[[~[[+id]]]]#comments" class="comments">
                    Comments ([[!QuipCount? &thread=`blog-post-[[+id]]`]])
                  </a>
                | <span class="date">[[+publishedon:strtotime:date=`%b %d, %Y`]]</span>
                      </span>
                    </p>
                </div>
                  • 3749
                  • 24,544 Posts
                  Try adding &tvPrefix=`` (unless all your TVs are prefixed by ’tv.’).
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 4882
                    • 44 Posts
                    Thanks.

                    Ive added it to the blog[13] page. Is this correct?

                    [[!getResourcesTag?
                      &elementClass=`modSnippet`
                      &element=`getResources`
                      &tpl=`blogPost`
                      &parents=`5,6`
                      &limit=`5`
                      &includeContent=`1`
                      &includeTVs=`1`
                      &tvPrefix=``
                      &showHidden=`0`
                      &hideContainers=`1`
                      &cache=`0`
                      &pageVarKey=`page`
                    ]]
                    [[!+page.nav:notempty=`
                    <div class="paging">  
                    <ul class="pageList">  
                      [[!+page.nav]]  
                    </ul>  
                    </div>
                    `]]


                      • 3749
                      • 24,544 Posts
                      That looks right. Clear the site cache and see if it helps.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting