RuFFijS Posted March 25, 2010 Report Share Posted March 25, 2010 sveiki! tātad šobrīd strādāju pie vienas lapas, kas balstīta uz wordpress. problēma ir sekojoša(itkā izguuglojos,bet neko jēdzīgu neatradu), ir header.php, kas tālāk attiecīgi tiek inclūdots index.php, un man vajadzētu kādas idejas par to kādu scriptu uzraxtīt, lai katrai lapai(piemēram foto, blogs,kontakti utt) header'ī ielādētu noteiktu bildi. piemēram ja lapas nosaukums ir foto, tad parāda bildi 1.jpg, ja nosaukums ir blogs tad parāda bildi 2.jpg utt netā atradu šādu scriptu, bet nešancē: <div id="header"> <?php if (is_page( 'Foto' )) { print '1.jpg" />'; }elseif (is_page( 'Kontakti' )) { print '2.jpg" />'; }else { print '10.jpg" />'; } ?> </div> paldies, jau iepriekš :) Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 25, 2010 Report Share Posted March 25, 2010 Reku tev dokumentācija par to, lai noskaidrotu kurā lapā šobrīd esi... http://codex.wordpress.org/Conditional_Tags Tas pats is_page() jau būs jāizmanto. Quote Link to comment Share on other sites More sharing options...
waplet Posted March 25, 2010 Report Share Posted March 25, 2010 (edited) vieglāk nebūtu ar rand? ja nu vienīgi tev nav katrai bildei noteikts virsraksts vajadzīgs. Snippet 3 Edited March 25, 2010 by waplet Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 25, 2010 Report Share Posted March 25, 2010 Kādā veidā te palīdzētu random? Ja man sadaļā 'Random' vajag bildi, kur rakstīts 'Te ir random šits', tad nekāds randoms nederēs... Quote Link to comment Share on other sites More sharing options...
2easy Posted March 25, 2010 Report Share Posted March 25, 2010 wapletam vnk vakars iestājies. kko uz random iepiļīja forumā un viss. neņem vērā ;) Quote Link to comment Share on other sites More sharing options...
waplet Posted March 25, 2010 Report Share Posted March 25, 2010 Snippet 3 ir keywords. Quote Link to comment Share on other sites More sharing options...
2easy Posted March 25, 2010 Report Share Posted March 25, 2010 (edited) waplet, Tu esi sācis pārāk gudri runāt :)) un tāda vienkāršā tauta, mani ieskaitot, tevi vnk nesaprot... :D:D:D Edited March 25, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
waplet Posted March 25, 2010 Report Share Posted March 25, 2010 1. http://codex.wordpress.org/Conditional_Tags 2. Snippet 3 3. :D Quote Link to comment Share on other sites More sharing options...
2easy Posted March 25, 2010 Report Share Posted March 25, 2010 (edited) 4. ohhh :D:D:D pareizi! mājiens ar mietu ir vislabākais :P Edited March 25, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
Roberts.R Posted March 26, 2010 Report Share Posted March 26, 2010 Kādreiz arī stulbi darīju, ka rakstīju if{}elseif{}elseif{}...elseif{}else... Tā neizskatās smuki. Ieteiktu labāk izmantot "switch". Quote Link to comment Share on other sites More sharing options...
2easy Posted March 26, 2010 Report Share Posted March 26, 2010 tur katrā else if ir sava pārbaude... tad switch neder Quote Link to comment Share on other sites More sharing options...
RuFFijS Posted March 26, 2010 Author Report Share Posted March 26, 2010 zinu ka ne tuvu na labaakais variants, bet nu vismaz viss shancee :) <?php if (is_front_page()) { ?> <div id="meitenes"></div> <?php } elseif (is_page( 'Komanda' )) { ?> <div id="div2"></div> <?php } elseif (is_page( 'Klubs' )) { ?> <div id="div3"></div> <?php } elseif (is_page( 'Kalendārs' )) { ?> <div id="div4"></div> <?php } elseif (is_page( 'Foto' )) { ?> <div id="div5"></div> <?php } elseif (is_page( 'Blogi' )) { ?> <div id="div6"></div> <?php } elseif (is_page( 'Atbalstītāji' )) { ?> <div id="div7"></div> <?php } elseif (is_page( 'Kontakti' )) { ?> <div id="div8"></div> <?php } elseif (is_page( 'Saites' )) { ?> <div id="div9"></div> <?php } ?> ja ir kaadas labaakas idejas,droshi izsakieties :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.