Jump to content


NewsListing


181 replies to this topic

#31 sottwell

    Etomite Forum Fan

  • Member
  • Pip
  • 60 posts

Posted 01 January 2005 - 05:06 PM

I originally wasn't using GET values, I was thinking to set the lang in the user's session; that way I wouldn't have to find all the code for generating links and modify it to add the query string. But since sessions aren't too consistant, then I went back to using GET. I don't know if I have to get the variable from GET myself, but I'm in the habit of doing that anyway; ever since RegisterGlobals got turned off by default, and I figure it can't hurt. I prefer to know where my data is coming from.

I finally got fed up with IE/Win, and went back to a table-based layout for my template. Even then it managed to f&*#k it up and I had to hack at the css to make it work right. What a pain.

#32 miels

    Etomite Forum Newbie

  • Member
  • 39 posts

Posted 05 January 2005 - 08:39 AM

The problem I'm having probably has something to do with the reason why they pages generated don't validate:

In the page where the [[NewsListing]] tag is found and the short stories are being displayed, the snippet seems to just cut of the text at the given length. It doesn't check for any html tags to be open or not.

I ran into this problem quite soon. The text got cut of where a link (<a href) was still open. This messed up the result.

It might help if the script checked if at the place where the text is being cut of any tags are open, which are being closed later on in the document. This eliminates the need of listing all tags that should be closed. When the source text is correct every tag should get closed as is should.

Unfortunately I don't have a clue how to implement this... Anybody does? :unsure:

#33 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 05 January 2005 - 02:29 PM

miels, on Jan 5 2005, 04:39 AM, said:

The problem I'm having probably has something to do with the reason why they pages generated don't validate:

In the page where the [[NewsListing]] tag is found and the short stories are being displayed, the snippet seems to just cut of the text at the given length. It doesn't check for any html tags to be open or not.

I ran into this problem quite soon. The text got cut of where a link (<a href) was still open. This messed up the result.

It might help if the script checked if at the place where the text is being cut of any tags are open, which are being closed later on in the document. This eliminates the need of listing all tags that should be closed. When the source text is correct every tag should get closed as is should.

Unfortunately I don't have a clue how to implement this... Anybody does? :unsure:
The task of checking for open HTML tags, as well as CSS elements, would take some work to implement... That isn't to say that it couldn't be done, however... Without doing some in-depth research into this I'd venture to guess that it would take more code to do the tag checking than the [[NewsListing]] snippet itself... This has been a concern that I have had when working on my Blog snippets... B)

#34 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 05 January 2005 - 02:45 PM

And this is one reason I prefer to rely on the "description" field rather than a truncated portion of the full content. Description has no HTML in it and was created specifically to be a descriptor of the document. I figured that was a pretty good thing to have as a teaser, and has worked well in my case. You may have different needs, but it's something to consider.

If you are willing to step away from truncated body text and look at using the description instead, then you have more snippet options available for use.

#35 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 05 January 2005 - 03:03 PM

jaredc, on Jan 5 2005, 10:45 AM, said:

And this is one reason I prefer to rely on the "description" field rather than a truncated portion of the full content. Description has no HTML in it and was created specifically to be a descriptor of the document. I figured that was a pretty good thing to have as a teaser, and has worked well in my case. You may have different needs, but it's something to consider.

If you are willing to step away from truncated body text and look at using the description instead, then you have more snippet options available for use.
Good point, Jared... And it wouldn't be very hard at all to modify any of the existing NewsListing/Blog snippets to perform as you have described... I haven't put the "description" field to much use and should prbably entertain the idea of doing so for future snippet designs/mod's... B)

#36 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 20 January 2005 - 02:11 PM

Its working perfect here, except for 1 thing!

example :

->news_content (20) (unpublished)
--->article1 (21)
--->article2 (22)
->news (23)

what should i do with news (23) to show the content of news_content (20) ?

[[NewsListing?id=20]] doesnt work....

help me please ? :)

#37 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 20 January 2005 - 02:16 PM

noobalyzed, on Jan 20 2005, 09:11 AM, said:

[[NewsListing?id=20]]  doesnt work....
Nope. That won't work. Try:

[[NewsListing?newsid=20]]


#38 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 20 January 2005 - 02:52 PM

ahh offcourse lol, thanks :)

#39 Guest_madbadrob_*

  • Guests

Posted 26 January 2005 - 09:23 PM

Firstly appologies if this is in the wrong place.

Can someone explain in words that a novice site builder can understand how the news section of a site works and the code that would be required to activate it. I have on my site http://acorn.rootschat.net three news boxes one for the latest one for the previous latest and the third for and so on. I just don't understand the coding

Thanx

Rob

#40 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 26 January 2005 - 09:47 PM

It's really pretty simple. Just create a new document and make sure it's parent is the "News" folder (which is found in the Repository folder). Both the repository and news folders are unpublished by default so the stories will not show up in the navigation, but will be picked up by the NewsListing snippet.

The code to put the news items on the home page is generated by the NewsListing snippet itself.

#41 Guest_madbadrob_*

  • Guests

Posted 26 January 2005 - 10:04 PM

jaredc, on Jan 26 2005, 10:47 PM, said:

It's really pretty simple. Just create a new document and make sure it's parent is the "News" folder (which is found in the Repository folder). Both the repository and news folders are unpublished by default so the stories will not show up in the navigation, but will be picked up by the NewsListing snippet.

The code to put the news items on the home page is generated by the NewsListing snippet itself.
Many thanks for that I will give that a go :)

Rob

#42 Dean

    Loves Etomite Forums!

  • Admin
  • 4,746 posts
  • Gender:Male

Posted 26 January 2005 - 10:14 PM

I've moved the last three posts into the relavant thread (this one) - to help keep the forum "tidy"

#43 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 27 January 2005 - 11:54 AM

got another thing, i edited the code a bit, but now it isnt showing the date & title on the page of the actual news, only the content... help please ?:)

#44 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 27 January 2005 - 12:41 PM

Can you attach the code (or include it if it's short? That will make the troubleshooting much easier :D

#45 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 27 January 2005 - 01:27 PM

$resourceparent = isset($newsid) ? $newsid : $etomite->documentIdentifier;
         // the folder that contains blog entries 
$output = '';
         // initialise the blog variable 
$nrblogs = 10;
         // nr of blogs to show a short portion of 
$nrblogstotal = 100;
         // total nr of blogs to retrieve 
$lentoshow = 150;
         // how many characters to show of blogs 

$resource = $etomite->getActiveChildren($resourceparent, 'createdon', 'DESC', $fields='id, pagetitle, description, content, createdon, createdby');
$limit=count($resource);
if($limit<1) { 
   $output .= "No entries found.<br />"; 
} 
$nrblogs = $nrblogs<$limit ? $nrblogs : $limit; 
if($limit>0) { 
   for ($x = 0; $x < $nrblogs; $x++) { 
   $tbl = $this->dbConfig['dbase'].".".$this->dbConfig['table_prefix']."manager_users";
      $sql = "SELECT username FROM $tbl WHERE $tbl.id = ".$resource[$x]['createdby']; 
      $rs2 = $etomite->dbQuery($sql);
      $limit2 = $etomite->recordCount($rs2); 
      if($limit2<1) { 
         $username .= "anonymous"; 
      } else { 
         $resourceuser = $etomite->fetchRow($rs2); 
         $username = $resourceuser['username']; 
         // strip the content 
         if(strlen($resource[$x]['content'])>$lentoshow) { 
            $rest = substr($resource[$x]['content'], 0, $lentoshow); 
            $rest .= "...<br />    <a href='".$resource[$x]['id'].".html'>More on this story ></a>"; 
         } else { 
            $rest = $resource[$x]['content']; 
         } 
         $output .= "<font face=verdana size='2'><b>»&nbsp;&nbsp;<a href='index.php?id=".$resource[$x]['id']."' onmouseover=this.style.textDecoration='underline' 
onmouseout=this.style.textDecoration='none'>".$resource[$x]['pagetitle']."</a></b> <div align=left>on ".strftime("%d-%m-%y %H:%M:%S", $resource[$x]['createdon'])."</div></font><br>"; 
      } 
   } 
}


return $output;

thats my NewsListing Snippet...

#46 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 28 January 2005 - 09:04 AM

So how do i get my title back @ the content of news pages ?

#47 Dean

    Loves Etomite Forums!

  • Admin
  • 4,746 posts
  • Gender:Male

Posted 28 January 2005 - 09:04 AM

Please do not bump up topics, as it will get you a reply no quicker :lol:
(I have no experience really with the snippet in question, otherwise I would help) - have you tried comparing yours to the original?

#48 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 28 January 2005 - 09:34 AM

yes, but i couldnt find it, i get confused looking at the snippet,

i didnt mean to bump up the topic m8, i allways got help here, and im patient enough :) sorry for that anyway, now can some1 help me? hehe...

#49 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 28 January 2005 - 02:23 PM

Quote

but now it isnt showing the date & title on the page of the actual news
I'm not 100% sure I understand the problem. Are you not seeing the title on the page with multiple stories listed? Or on the page where the whole story appears by itself?

#50 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 28 January 2005 - 03:11 PM

I dont see the title when i go to see the full stury of 1 specific newsarticle





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users