Jump to content
php.lv forumi

lapas atrašanās vieta


Edijs87

Recommended Posts

#1 variants: var izveidot atsevišķus failus, kur vienādais saturs ("header's", navigācija, "footer's") ir dublēts. Slikts variants...

#2 variants: izveidot failus header.php un footer.php, piemēram. Tajos atradīsies tas, kas būs kopīgs visām lapām. Tad tos iekļauj katrā lapā...

 

<?php

require 'header.php'; // Vai "*.html".

?>

<p>Seika, pasaule!</p>

<?php

require 'footer.php';

?>

Link to comment
Share on other sites

@anonīms, pirmkārt, Es taisītu visu uz MVC arhitektūras, bet tas jau cits stāsts... Bet kur problēma "title'am"? "Global scope".

 

$title = 'Mana lapa';

require 'header.php';

 

header.php

 

<?php echo $title; ?>

Un kaut kāds HTML...

 

P.S. Nedaudz uzlabots (reāls "downgrade") @gta1151 variantam. Nav jēgas tur funkciju veidot.

Link to comment
Share on other sites

@anonīms, pirmkārt, Es taisītu visu uz MVC arhitektūras, bet tas jau cits stāsts... Bet kur problēma "title'am"? "Global scope".

 

$title = 'Mana lapa';

require 'header.php';

 

header.php

 

<?php echo $title; ?>

Un kaut kāds HTML...

 

P.S. Nedaudz uzlabots (reāls "downgrade") @gta1151 variantam. Nav jēgas tur funkciju veidot.

 

Tā arī var,katram sava gaume kodēšana.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...