Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Zamiana komentarzy HTML na PHP, if
Subsequently
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 16.06.2009

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


Hej!
Mam na stronie system szablonów. Podpatrzyłem w kodzie phpBB, w szablonach, mniej więcej takie coś ( chodzi mi o te if-y w komentarzach ) :
  1. <!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
  2. <form method="post" action="{S_LOGIN_ACTION}" class="headerspace">
  3. <h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED -->&nbsp; &bull; &nbsp;<a href="{U_REGISTER}">{L_REGISTER}</a><!-- ENDIF --></h3>
  4. <fieldset class="quick-login">
  5. <label for="username">{L_USERNAME}:</label>&nbsp;<input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" />
  6. <label for="password">{L_PASSWORD}:</label>&nbsp;<input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" />
  7. <!-- IF S_AUTOLOGIN_ENABLED -->
  8. | <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label>
  9. <!-- ENDIF -->
  10. <input type="submit" name="login" value="{L_LOGIN}" class="button2" />
  11. </form>
  12. <!-- ENDIF -->

Próbowałem takie coś zrobić u mnie. Inne takie bajery w komentarzach wyszły ale to nie (IMG:style_emoticons/default/sad.gif)
np. include robię tak:
  1. <?php
  2. $inc = preg_match_all ("/(<!-- INCLUDE (.*?) -->)/", $this->plik['glowny'], $include);
  3. $incKeys = array_keys($include);
  4. foreach ( $incKeys as $k ){
  5. $this->elements['includes'][$include[$k][0]] = $include[$k][0];
  6. $this->elements['includes'][$include[$k][1]] = $include[$k][1];
  7. $this->elements['includes'][$include[1][$k]] = $include[1][$k];
  8. $this->elements['includes'][$include[0][$k]] = $include[0][$k];
  9. }
  10. //a potem zamiana
  11. $keys = array_keys( $this->elements['includes'] );
  12. foreach ( $keys as $k ) {
  13. $this->gotowy_szablon = str_replace( "<!-- INCLUDE " . $k . " -->", "<?php include \"" . $this->element['SZABLONY_SCIEZKA'] . $this->elements['includes'][$k] . "\"; ?>", $this->gotowy_szablon );
  14. }
  15. // i include działa ;)
  16. ?>

Jakby mógł ktoś coś podpowiedzieć, byłoby miło (IMG:style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 23.08.2025 - 17:55