|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Bullett Smarty n00b
Joined: 25 Jun 2003 Posts: 3
|
Posted: Wed Jun 25, 2003 11:22 am Post subject: News from a txt file |
|
|
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 |
|
|
|
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
|