Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

News from a txt file

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Bullett
Smarty n00b


Joined: 25 Jun 2003
Posts: 3

PostPosted: Wed Jun 25, 2003 11:22 am    Post subject: News from a txt file Reply with quote

Hello, at the beginning sorry for my poor english.
I have a site in php and now i would like to convert it into smarty.
I have a following problem. I would like to make v. simple news system. I do not post many news that's why i don't use database. I used to use txt file.

Now i have made something like that:
Code:

inedx.tpl

{foreach from=$news item=item key=key }
{$key} {$item}<br>

{if ($item|count_words) > 5} {*  value 5 only for tests*}
{$item|truncate:50:"..."}<a href=more.php?id={$key}>[read more]</a>
{else}
{$item}
{/if}
{/foreach}

index.php
$smarty->assign('news',
   array(
   "1" => "this is news asdsad ",
   "2" => "and this is second one blah blah ",
   "3" => "iiiiha and what about this one muahha"
   ));
 

<a href=more.php?id={$key}>[read more]</a> this is my main problem how to make it works. Regards
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP