Jump to content

Skinning News


flynryan692

Recommended Posts

Ok, so on my frontpage I have a column for each thing like new pilots, pirep and news, now the news is setup to only show the first few sentences of the story then I have a read more link...what I want to do is limit the number of characters that are shown, then I want the full story to be in another file. I'm guessing I'll need to edit the news_newsitem.tpl file to only show x amount of letters and what not then make a new .tpl file to have the full story in.

So, here is my question, how do I limit the characters..like the php..I'm a php n00b..

How do I echo the link to the full story..I'm guessing each news story has an id in the database..? Php is so confusing...sorry..

Thanks.

Link to comment
Share on other sites

  • Administrators

You can limit the number of characters returned in a string using substr

substr($data,0,100)

would return the characters from position 0 to position 100 in the $data string.

To echo a link to your news item you could add

$this->set('id', $row->id);

on the blank line 46 in news.php in root/core/modules/news

then in your template echo it out something like

echo '<a href="'.url(my_custom_news).'/'.$id.'">Click For Full Story</a>

That would point to a module you have built "my_custom_news", you can name it whatever you want, that would collect the news id number and you can point it to a tpl that will show the entire news story.

Or you could just use - Simpilot PopUpNews Module

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...