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

wyświetlenie tekstu z pliku

 
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 -> Language: Polish
View previous topic :: View next topic  
Author Message
anka
Smarty n00b


Joined: 09 Dec 2009
Posts: 1

PostPosted: Wed Dec 09, 2009 1:23 pm    Post subject: wyświetlenie tekstu z pliku Reply with quote

Mam taki problem: chcę przekazać do szablonu tekst zawarty w pliku (w bazie danych).
Teraz szablon includuje plik ({include file="sciezka_do_pliku"}) ale ja chcę, żeby do szablonu był przekazywany już sam tekst, bo muszę go 'potraktować' modyfikatorem truncate.
W tej chwili mam coś takiego:
klasa tekstfile() zawira metodę readFileContent():
Code:

function readFileContent() {
      if (file_exists($this->fileUsed) && (filesize($this->fileUsed))) {

            $handle = fopen($this->fileUsed,"r");
            $content = fread($handle,filesize($this->fileUsed));
            fclose ($handle);

            return trim($content);
      } else {
         return "";

      }
   }


index.php

Code:

$tempTab = $listOfDates->GetList();
$string='E://xampp/htdocs/serwis/terminarz/';

for( $i = 0, $last = count( $tempTab ); $i < $last; $i++ )
{
       $zajawka= new TextFile($string,$tempTab[$i][3]);
}

$zajawka= new TextFile($string,$tempTab[$i][3]);
$smarty->assign('tekst',$zajawka->readFileContent);


index.tpl
Code:

{section name='list1' loop=$listOfNews}
...
{$tekst[list1][3]}
...
{/section}


na razie nie daję truncate bo mi nie chce wcale wyświetlić Crying or Very sad

Proszę o pomoc bo siedzę nad tym cały dzień i nie mam pojęcia co robię źle Sad
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 -> Language: Polish 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