Jump to content


ListDocuments


  • You cannot reply to this topic
50 replies to this topic

#1 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 23 July 2005 - 12:32 AM

I have added a new snippet to the Snippet Library!

Snippet name: ListDocuments
Author: Ralph (rad14701)
Version: 1.0 (Final)
More info: View this snippet
Description:
Displays document listings based on provided criteria

Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)

[This is an automatically created message]

#2 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 05 September 2005 - 09:18 PM

Thanks - I was wondering about a news snippet for multiple news folders and found this.

I found that it didn't work for me though, 'cos I have a very narrow panel holding this snippet, and the author section wraps, making the appearance a mess as the 'author' and 'Read ...' bits extend well beyond the bottom of the box.

I've fudged it for my purposes by chaging the $output generation to

Quote

    $output .= "
    <div ".$entry_box_css.">
     
      <div ".$title_css.">
        ".$rs[$x]['pagetitle']."
      </div>
     
      <div ".$text_css.">
       
        ".$rest."
    <br>
        <div style='text-align:left; float:left;'>
          ".$author."
          <div ".$author_css.">
            ".$username."
          </div>
          ".$between." ".strftime($date_time_format, $rs[$x]['createdon'])."
        </div>
    <div style='clear:both; margin-bottom:.5em;'></div>
        <div style='text-align:right; float:right;'>
          <a href='[~".$rs[$x]['id']."~]'>".$more."</a>
        </div>
     
      </div>
     
      <br />
   
    </div>
    <br />";
but can't honestly say I understand it. Must get a CSS reference and a PHP manual. (Both largely "after my time" as a web designer)

#3 Guest_menatep_*

  • Guests

Posted 09 September 2005 - 12:29 AM

This snippet does not work for me. When I try to use it in my system, I get the following error:

Fatal error: Call to undefined function: getinttablerows() in /home/.*****/******/phiwi.com/index.php(490) : eval()'d code on line 85

I'm just using "[!ListDocuments!]" in the page with no special arguements.

Using:

Etomite Content Management System 0.6.1-RC2 (Prelude)

PHP 4.3.10

MySQL 4.1.13a


Thank you

#4 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 09 September 2005 - 12:53 AM

menatep, on Sep 8 2005, 09:29 PM, said:

This snippet does not work for me. When I try to use it in my system, I get the following error:

Fatal error: Call to undefined function: getinttablerows() in /home/.*****/******/phiwi.com/index.php(490) : eval()'d code on line 85

I'm just using "[!ListDocuments!]" in the page with no special arguements.

Using:

Etomite Content Management System 0.6.1-RC2 (Prelude)

PHP 4.3.10

MySQL 4.1.13a
Thank you
Doublecheck your snippet code to make sure that the API function call is getIntTableRows() and not getinttablerows()... Function names are case sensitive... If you upgraded to RC2 make sure you overwrote the pre-existing index.php file... Keep me posted on your progress...

#5 Guest_menatep_*

  • Guests

Posted 09 September 2005 - 09:16 PM

Ralph (rad14701), on Sep 8 2005, 08:53 PM, said:

Doublecheck your snippet code to make sure that the API function call is getIntTableRows() and not getinttablerows()... Function names are case sensitive... If you upgraded to RC2 make sure you overwrote the pre-existing index.php file... Keep me posted on your progress...

Ahh yes, it seems that the index.php wasn't transferred properly during the upgrade. This fixed the problem, thank you.

An excellent Snippet by the way, just what I was looking for :D

Edited by menatep, 09 September 2005 - 09:17 PM.


#6 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 11 September 2005 - 12:02 AM

Where does this snippet get called up in?

Any old document?

Does the parent folder of the news documents need to be published or unpublished?

Where do I type in the folder ID of the news folder?

These questions and more...

I have this:

$ids = isset($ids) ? $ids : $etomite->documentIdentifier;

Is this the line where I put the ID? and where does it go. I'm such a dummy when it comes to your snippets Ralph. Seems I can never just put them in 'out of the box' and get them up and running, like I can with others, lol.

Also I get this error when I go to the document that I *think* I am supposed to call up the snippet in.

Parse error: parse error, unexpected ',' in /home/.caboodle/bwoodzy/bwoodsdesign.com/index.php(554) : eval()'d code on line 85

Any suggestions?

#7 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 11 September 2005 - 12:32 AM

bwoodsdesign, on Sep 10 2005, 09:02 PM, said:

Where does this snippet get called up in? 

Any old document?

Does the parent folder of the news documents need to be published or unpublished?

Where do I type in the folder ID of the news folder? 

These questions and more...

I have this:

$ids = isset($ids) ? $ids : $etomite->documentIdentifier;

Is this the line where I put the ID?  and where does it go.  I'm such a dummy when it comes to your snippets Ralph.  Seems I can never just put them in 'out of the box' and get them up and running, like I can with others, lol.

Also I get this error when I go to the document that I *think* I am supposed to call up the snippet in.

Parse error: parse error, unexpected ',' in /home/.caboodle/bwoodzy/bwoodsdesign.com/index.php(554) : eval()'d code on line 85

Any suggestions?

If you don't send the $ids variable in your snippet call the snippet will automatically use the calling documents id, which should then be a folder... If you send one or more id's in the snippet call then the snippet will use all id's sent... So, for instance, if you want to call the snippet from a page which has the id of 10 and want it is not a folder you will receive an error because it has no children... But if you call the snippet from page 10 and send it ids=20,25,28 then the snippet will use the contents of folders 20, 25, and 28 to get the articles from and they will be displayed on page 10, the calling document... I hope this helps... I'm sure some of my snippets could use more documentation for those members who can't figure out the logic from the PHP code... My apologies for not providing adequate documentation... :blush:

#8 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 11 September 2005 - 12:52 AM

Ralph (rad14701), on Sep 10 2005, 08:32 PM, said:

If you don't send the $ids variable in your snippet call the snippet will automatically use the calling documents id, which should then be a folder... If you send one or more id's in the snippet call then the snippet will use all id's sent... So, for instance, if you want to call the snippet from a page which has the id of 10 and want it is not a folder you will receive an error because it has no children... But if you call the snippet from page 10 and send it ids=20,25,28 then the snippet will use the contents of folders 20, 25, and 28 to get the articles from and they will be displayed on page 10, the calling document... I hope this helps... I'm sure some of my snippets could use more documentation for those members who can't figure out the logic from the PHP code... My apologies for not providing adequate documentation...  :blush:

Ok. My parent folder is 105 and has children (2 so far, more on the way) and I have placed the call for the snippet as [!ListDocuments?ids=105!] in the calling document. I still get an error code...albeit a different one:

Parse error: parse error, unexpected ',' in /home/.caboodle/bwoodzy/bwoodsdesign.com/index.php(554) : eval()'d code on line 67

I am still not sure what I'm doing wrong.

#9 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 11 September 2005 - 01:32 AM

bwoodsdesign, on Sep 10 2005, 09:52 PM, said:

Ok.  My parent folder is 105 and has children (2 so far, more on the way) and I have placed the call for the snippet as [!ListDocuments?ids=105!] in the calling document.  I still get an error code...albeit a different one:

Parse error: parse error, unexpected ',' in /home/.caboodle/bwoodzy/bwoodsdesign.com/index.php(554) : eval()'d code on line 67

I am still not sure what I'm doing wrong.
I'm guessing that there may be a problem with reading the snippet code... As submitted the code has several function calls formatted like:

$fields = '
  id,
  pagetitle,
  description,
  content,
  createdon,
  createdby
';

this one starting on line 67... These multi-line function calls may be the problem... Try modifying these lines to be more like:

$fields = 'id,pagetitle,description,content,createdon,createdby';

to see if this makes any difference... It's worth a shot, anyway...

#10 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 11 September 2005 - 11:31 PM

Thanks for the tip.

However, after I have done the above steps as recommended, here is what I get now:

Parse error: parse error, unexpected ',' in /home/.../..../bwoodsdesign.com/index.php(554) : eval()'d code on line 60

Approximately line 60 is the line where it is the config for the date/time. Am I supposed to leave that line as is, or put the date/time code I want in there?

bleah.

#11 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 12 September 2005 - 01:24 AM

bwoodsdesign, on Sep 11 2005, 08:31 PM, said:

Thanks for the tip.

However, after I have done the above steps as recommended, here is what I get now:

Parse error: parse error, unexpected ',' in /home/.../..../bwoodsdesign.com/index.php(554) : eval()'d code on line 60

Approximately line 60 is the line where it is the config for the date/time.  Am I supposed to leave that line as is, or put the date/time code I want in there?

bleah.
My line 60 has nothing to do with data and time... PM or email me your snippet code and I will test it on my end to see if I can get it working... That would probably be quicker than hit and miss diagnosis...

#12 spear

    Etomite Forum Fan

  • Member
  • Pip
  • 61 posts

Posted 29 September 2005 - 07:57 PM

Hi Ralph,

I think that this snippet is great and can be used for many different purposes, but I can not make it to work :( .
Almost 2 hours I try many combinations, but all failed.
Here is step by step what I did, may be you will see my error:
1. New snippet - I creared [[!ListDocuments!]] - the content is excatly your one I simpy copy/paste.
2. Then I created new folder with name News and ID=25
3. Then I created 3 new documents in this folder(id=25) with names news 1, news 2, news 3 with ids=24,26,27 and filled them with content.
4. Then in folder News I wrote this: [!ListDocuments?ids=25&numListings=3&maxListings=3&maxChars=200!]
All saved!
I launched www.mysite.com/index.php?id=25 , but it is empty, there have not the listed sub-documents :( .
Where is my error?

regards,
spear

Edited by spear, 29 September 2005 - 07:58 PM.


#13 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 29 September 2005 - 09:44 PM

spear, on Sep 29 2005, 04:57 PM, said:

Hi Ralph,

I think that this snippet is great and can be used for many different purposes, but I can not make it to work  :( .
Almost 2 hours I try many combinations, but all failed.
Here is step by step what I did, may be you will see my error:
1. New snippet - I creared [[!ListDocuments!]] - the content is excatly your one I simpy copy/paste.
2. Then I created new folder with name News and ID=25
3. Then I created 3 new documents in this folder(id=25) with names news 1, news 2, news 3 with ids=24,26,27 and filled them with content.
4. Then in folder News I wrote this: [!ListDocuments?ids=25&numListings=3&maxListings=3&maxChars=200!]
All saved!
I launched www.mysite.com/index.php?id=25 , but it is empty, there have not the listed sub-documents  :( .
Where is my error?

regards,
spear
This snippet should work when implemented as you have described but this is not how I use it personally... I don't generally call the snippet from within the folder which contains the documents I wish to display... I have tested the snippet in this fashion and it does work properly, however... I'm assuming that you are using Etomite 0.6.1 or are using the modified version which I have posted for use with Etomite 0.6 as this snippet was originally developed to use several API functions which are not present in the standard 0.6 release... Documents must be published and the folder must also be published if you are calling the snippet from within the folder document itself... I'm sure we can get you up and running... B)

This is the snippet call which is located at the top of the front page of my site (Home)... I'm calling it from a document, not a folder... It did test okay when called from within a parent folder, however...
[!ListDocuments?ids=11,27,34,119&numListings=3&maxListings=3&maxChars=300!]

Edited by Ralph (rad14701), 29 September 2005 - 09:48 PM.


#14 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 29 September 2005 - 09:51 PM

With the setup you've described, I think just [!ListDocuments!] should work without the other parameters. (The ids you quote are the automatically assigned ids?)

#15 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 29 September 2005 - 10:19 PM

mikef, on Sep 29 2005, 06:51 PM, said:

With the setup you've described, I think just [!ListDocuments!] should work without the other parameters. (The ids  you quote are the automatically assigned ids?)
Yes, the snippet call should work without any parameters being passed when used as spear has described... The defaults are as listed below unless the defaults have been changed in the snippet code itself... There is probably room for a few more options but, as listed, the snippet addresses most needs...

numListings = 3
maxListings = 100
maxChars = 150

#16 spear

    Etomite Forum Fan

  • Member
  • Pip
  • 61 posts

Posted 29 September 2005 - 10:23 PM

Yes I am using v.0.6.
I downloading now 0.6.1 RC2. I will install it and will test again this snippet.
Thank you for your fast response !

#17 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 29 September 2005 - 10:49 PM

When first trying out a snippet, I find it easier to use the defaults first if possible, and then later make use of the configurable options. Lessens the chance of making mistakes with the parameters!

One of the things I like about etomite, though, is how easy it is to tinker with the snippets when really you want something just a little bit different, once you've got the provided code working.

#18 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 29 September 2005 - 11:56 PM

spear, on Sep 29 2005, 07:23 PM, said:

Yes I am using v.0.6.
I downloading now 0.6.1 RC2. I will install it and will test again this snippet.
Thank you for your fast response !
You can find the Etomite 0.6 version of this snippet by following this link...

#19 spear

    Etomite Forum Fan

  • Member
  • Pip
  • 61 posts

Posted 30 September 2005 - 01:02 PM

Work fine with 0.6.1 RC2. Thank you for your support !!!

#20 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 14 November 2005 - 07:25 PM

I'd like to be able to put a snippet into ListDocuments, but when I do it appears as [!snippetname!] in the text. I can understand why it might not always be a good idea :betterwink: but I'd like the option. I thought etomite recursively worked through the generated pages until there wasn't anything to change or until a limit was reached.

Is there something in the snippet that I haven't noticed stopping this, or is the recursion limit being hit - if the latter, where can I change it, please?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users