Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z zamiana
jarek
post 29.08.2002, 15:42:51
Post #1





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 29.08.2002

Ostrzeżenie: (0%)
-----


Witam,

Mam taki problem pisze obecnie projekt w którym chce wykorzystać templaty cos takiego jak w phpBB2. Tylko nie wiem jak sie zabrac do tego aby skrypt po przeanalizowaniu zawartosci pliku template znalazl wszystkie wyrazenia bedace w formie np. {TYTUL} i zamienil je na odpowiednie elementy tablicy w tym wypadku chcialbym aby zamienialo to na $element['TYTUL'].

Bardzo prosze o pomoc i z góry dziękuje.


pozdrawiam
jarek
Go to the top of the page
+Quote Post
Officerrr
post 30.08.2002, 13:08:50
Post #2





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 30.08.2002

Ostrzeżenie: (0%)
-----


z manuala php
[ciach]

str_replace (mixed search, mixed replace, mixed subject)
This function returns a string or an array with all occurences of search in subject replaced with the given replace value. If you don't need fancy replacing rules, you should always use this function instead of ereg_replace() or preg_replace().

In php 4.0.5 and later, every parameter to str_replace() can be an array.

If subject is an array, then the search and replace is performed with every entry of subject, and the return value is an array as well.

If search and replace are arrays, then str_replace() takes a value from each array and uses them to do search and replace on subject. If replace has fewer values than search, then an empty string is used for the rest of replacement values. If search is an array and replace is a string; then this replacement string is used for every value of search. The converse would not make sense, though.

Przykład 1. str_replace() example
$bodytag = str_replace("%body%", "black", "<body text=%body%>");

[/ciach]


--------------------
--
[Linux Administrator]
Go to the top of the page
+Quote Post
hyper
post 30.08.2002, 13:15:52
Post #3





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.03.2002
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Zamiast sikać pod wiatr proponowałbym zainteresowanie się:

Smarty - http://smarty.php.net/
FastTemplates - idunno


--------------------
Tomasz Wasiluk
Polcode >> Szukamy programistów z pasją
Go to the top of the page
+Quote Post
haiaw
post 30.08.2002, 19:40:05
Post #4





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: --
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Cytat
Zamiast sikać pod wiatr proponowałbym zainteresowanie się:

Smarty - http://smarty.php.net/
FastTemplates - idunno


Smarty to jeden z najbardziej rozbudowanych systemow templeatowych.
W dodatku na standardowej instalacji php ( bez akceleratorow) jest bardzo wolny.
Dlatego tez na prywatny uzytek polecam jednak Fast Templates


--------------------
Pozdrawiam,
Piotr Drewnik || haiaw@crew.php.pl
Go to the top of the page
+Quote Post
jarek
post 30.08.2002, 19:45:47
Post #5





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 29.08.2002

Ostrzeżenie: (0%)
-----


a gdzie moge zdobyc fast template?
Go to the top of the page
+Quote Post
jarek
post 30.08.2002, 19:59:47
Post #6





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 29.08.2002

Ostrzeżenie: (0%)
-----


ok mam juz dzieki http://phpclasses.mysiar.net/browse.html/p...package/23.html
Go to the top of the page
+Quote Post
hyper
post 30.08.2002, 22:08:36
Post #7





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.03.2002
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Cytat
Smarty to jeden z najbardziej rozbudowanych systemow templeatowych.
W dodatku na standardowej instalacji php ( bez akceleratorow) jest bardzo wolny.  
Dlatego tez na prywatny uzytek polecam jednak Fast Templates


Jesli zastosowac cachowanie strony to wcale nie wychodzi tak zle.


--------------------
Tomasz Wasiluk
Polcode >> Szukamy programistów z pasją
Go to the top of the page
+Quote Post
haiaw
post 30.08.2002, 23:43:46
Post #8





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: --
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Cytat
Cytat
Smarty to jeden z najbardziej rozbudowanych systemow templeatowych.
W dodatku na standardowej instalacji php ( bez akceleratorow) jest bardzo wolny.  
Dlatego tez na prywatny uzytek polecam jednak Fast Templates


Jesli zastosowac cachowanie strony to wcale nie wychodzi tak zle.



Ale cachowanie to nie zawsze dobry pomysl. 8)

http://www.phpinsider.com/php/code/Smarty/benchmarks/


--------------------
Pozdrawiam,
Piotr Drewnik || haiaw@crew.php.pl
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 8.07.2025 - 08:38