Jump to content


ListDocuments


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

#41 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 19 December 2008 - 09:40 PM

View Postbwoodsdesign, on Dec 19 2008, 03:57 PM, said:

The trouble isn't that the snippets aren't working, it's just that I want to know how I can make it so that when I enter certain data into the [*pagetitle*], [*description*], etc. fields in the "Identification" tab, that it shows the info properly on the home page instead of just on that article's page.

Shouldn't be a problem... If you check the snippet code that selects the records you will most likely find that it isn't grabbing all of the fields you want... You can either add the extra fields into the list or use * to get all fields...

ORIGINAL

// assign which data fields to extract from table rows

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

TRY

// assign which data fields to extract from table rows

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

OR

// assign which data fields to extract from table rows

$fields = '*';


#42 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 19 December 2008 - 10:07 PM

Thanks, I will try one of these and get back to you!

-Bobbi Jo

#43 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 19 December 2008 - 10:16 PM

OK that seemed to do not much different.

If you look at the home page: http://www.bwoodsdesign.com/choiceauto and see the yellow box (middle column) you'll see that the output is showing the unparsed Etomite tags...

...but if you click on "View this deal" (basically the "full story link") it looks right.
(http://bwoodsdesign....yota-camry.html)

Do I need to NOT include those fields into the actual child document which resides in the parent? (id 42 parent, id 41 child - the 2006-toyota-camry.html doc)

#44 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 19 December 2008 - 11:17 PM

View Postbwoodsdesign, on Dec 19 2008, 05:16 PM, said:

OK that seemed to do not much different.

If you look at the home page: http://www.bwoodsdesign.com/choiceauto and see the yellow box (middle column) you'll see that the output is showing the unparsed Etomite tags...

...but if you click on "View this deal" (basically the "full story link") it looks right.
(http://bwoodsdesign....yota-camry.html)

Do I need to NOT include those fields into the actual child document which resides in the parent? (id 42 parent, id 41 child - the 2006-toyota-camry.html doc)

You cannot use document field tags for the records you are attempting to display, they only work for the active document being rendered by the parser... You need to format the record variables into the output rendered within the snippet like how the author and date are displayed...

#45 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 22 December 2008 - 07:15 PM

So essentially, I can only call the ListDocuments snippet once, in one document? Can't echo it on another page? I'm trying to include the car listings docs within parent ID 42 into a block on my home page as well (see http://www.bwoodsdes...com/choiceauto)

#46 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 22 December 2008 - 08:32 PM

View Postbwoodsdesign, on Dec 22 2008, 02:15 PM, said:

So essentially, I can only call the ListDocuments snippet once, in one document? Can't echo it on another page? I'm trying to include the car listings docs within parent ID 42 into a block on my home page as well (see http://www.bwoodsdesign.com/choiceauto)

I don't understand the whole "echo" part... Yes, you can call ListDocuments as many times as you need, even on multiple pages... The part you aren't getting is that you can't use document field tags within a snippet, only in templates, documents, and, perhaps, chunks... I can't guarantee that they will work in Chunks, however...

I think I need a better understanding of exactly what it is that you're trying to accomplish in order to give a more concise answer... ListDocuments should be used for listing the child documents which contain your auto listings... It creates the list... Now, each individual auto can also be displayed on its own page... The data displayed on its own page can comprise of document field tags... The listing data must use the record variables pulled from the database... This means that it could be the same data, but accessed in two different ways...

I'm kinda guessing that you might be making this out to be more difficult than it really is... Once you see how close you are to having what you need, I think you'll be amazed...

EDIT:
Kinda looks like you may have it working...

#47 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 22 December 2008 - 09:01 PM

Yup...got it working. Here's what I did.

I used [[NewsListing?newsid=42]] on the HOME page content area to pull up the items called up in the ListDocuments - Thankfully, they work well together.

My only trouble now, is styling the CSS for h1 class="newsTitle" which is making a huge font of the title of the resulting newspage doc and putting it in a <ul> <li>

Fiddling with it now.

#48 danlanphear

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 24 February 2009 - 10:01 PM

Hi Ralph,

I just added ListDocuments to a test page. It seems to be working fine, but I discovered that it is displaying the snippet calls when they appear in another document.

Here's the output I'm getting:

Contact
[!KMail!]
Posted by: Webmaster
2009-01-28
Read more »

Here's the code:

<ol>
	 <li>
			 <h3>Contact</h3>
			 <blockquote>
				 [!KMail!]
			 </blockquote>
			 <cite>Posted by: Webmaster</cite>
			 <p>2009-01-28</p>
			 <a href="contact.php">Read more &raquo;</a>
		 </li>
	 </ol>


Of course, this is showing my "Contact" page as a recent update, and it is showing my Kmail snippet call. That's bad. I don't need to show this particular page, but the real question is, how do I include docs with snippet calls in them without this type of problem occurring?

Thanks,
Dan

Edited by danlanphear, 25 February 2009 - 01:35 AM.


#49 danlanphear

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 25 February 2009 - 02:02 AM

Second issue...

Here's my $output code:

	// format the news listing for display
	  $output .= "
		  <li>
				  <h3>".$rs[$x]['pagetitle']."</h3>
				  <blockquote>
					  ".$rest."
				  </blockquote>
				  <cite>".$author."".$username."</cite>
				  <p>".strftime($date_time_format, $rs[$x]['createdon'] + $server_offset_time)."</p>
				  <a href=\"[~".$rs[$x]['id']."~]\">".$more."</a>
		  </li>";
	}
  }
  
  // display list of links to older news articles
  if(($limit > $numListings) && ($numListings < $maxListings)) {
	$output .= "".$olderNews."";
	for ($x = $numListings; $x < $limit; $x++) {
	  $output .= "<li><a href=\"[~".$rs[$x]['id']."~]\">".$rs[$x]['pagetitle']."</a></li>";
	}
  }

I'd like a function that will allow me to put <ol> & </ol> tags at the beginning and end of these lists. Adding it to the $output variable just makes each list item its own list, which is pointless.

How do I do this?

Third issue ...

How can I specify a date range for the list, i.e. only list documents updated in the last week, as opposed to just a particular date or a particular number of listings?


Fourth issue ... ListDocuments doesn't seem to grab all of the html tags associated with the beginning of the document. It's just printing the text without enclosing it in the appropriate tags. This is causing my browser to throw html errors. I can't just add <p> tags to the snippet because not everything that starts the document would work with <p> tags. On the other hand, it seems to work fine with other pages. Here's an example of the output I'm getting:

	<ol>
		 <li>
				 <h3>Youth Activities</h3>
				 <blockquote>
					 
   The Cause Youth Convention:
   
	 Dates: Thursday April 9th and Friday April 10th
	 Locati &hellip;
				 </blockquote>
				 <cite>Posted by: Miss Debbie</cite>
				 <p>2009-02-24</p>
				 <a href="youth_activities.php">Read more &raquo;</a>
		 </li>
	 </ol>
		 <ol>
		 <li>
				 <h3>Pizza Party</h3>
				 <blockquote>
					 
 A Pizza Party will be held Friday, March 6th at 5:30 p.m. at Pastor Ron's house in Olyphant.
 Dire &hellip;
				 </blockquote>
				 <cite>Posted by: Webmaster</cite>
				 <p>2009-02-17</p>
				 <a href="pizza.php">Read more &raquo;</a>
		 </li>
	 </ol>
		 <ol>
		 <li>
				 <h3>Pastor</h3>
				 <blockquote>
					 
 Pastor Ron Liples comes to the pulpit of Cross Road Assembly with a wide range of education and ex &hellip;
				 </blockquote>
				 <cite>Posted by: Webmaster</cite>
				 <p>2009-02-12</p>
				 <a href="pastor.php">Read more &raquo;</a>
		 </li>
	 </ol>
		 <ol>
		 <li>
				 <h3>News Archive</h3>
				 <blockquote>
					 
 <p>Archived list of old news items</p>
				 </blockquote>
				 <cite>Posted by: Webmaster</cite>
				 <p>2009-01-28</p>
				 <a href="news-archive.php">Read more &raquo;</a>
		 </li>
	 </ol>
		 <ol>
		 <li>
				 <h3>RSS</h3>
				 <blockquote>
					 
 <p>Form to subscribe to RSS service</p>
 <p>What's RSS?</p>
				 </blockquote>
				 <cite>Posted by: Webmaster</cite>
				 <p>2009-01-28</p>
				 <a href="rss.php">Read more &raquo;</a>
		 </li>
	 </ol>

As you can see, some of the list items have text just floating there with no tags, while others have tags. How do I fix this?

Thanks,
Dan

Edited by danlanphear, 25 February 2009 - 02:16 AM.


#50 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 25 February 2009 - 03:13 PM

Wow, danlanphear, that's a hefty list of issues you have there... I'll try to summarize here but it might be easier, and cause less bloating here, to do this via PM's... Your questions hit a broad range...

Not sure why snippet calls aren't being parsed unless it is because of your snippet call convention... Sometimes you need to experiment between [[...]] and [!...!] to see which one works best... I thik I have fixing or attempting to fix that on my list for v1.2 if I'm not mistaken...

Date ranging is goning to be a bit trickier... Dates are stored as unix timestamps so you would need to add code into the snippet which accepts a standard date, converts that date to a unix timestamp using strtotime(), and using the dates in the query to limit the results...

There is no reason why you shouldn't be able to modify the code to make use of an ordered list or multiple ordered lists...

As I recall, due to tag nesting within documents, all tags shuold be getting stripped by ListDocuments before being rendered... This eliminates orphaned tags which could otherwise wreak havoc with overall page formatting...

And finally, perhaps it would be easier to just write and entire new snippet, using this one as a starting point... Sometimes that's easier than hacking existing code... Probably not an option for you at this point, however...

#51 danlanphear

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 25 February 2009 - 09:40 PM

Ralph,

Thanks for getting back to me quickly. Actually, I like this snippet for the most part, but if you know of one that would suit my needs better, that would be very helpful. I'm not really able to modify the functions myself. I will experiment with the [[ vs. [! snippet calls. I'll send you PMs on this.

Dan





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users