Jump to content

Antonella

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Italy

Antonella's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Anyone? the problem,briefly, is that you have to refresh twice, before the right layout is loaded. Is it possible that the firstly the script writes the cookie and on the second refresh it reads the cookie and displays the layout? ???
  2. I've changed the code, but the result is the same. You call a skin, the page refreshes, but the layout remains the same until you refresh again, and if you have no cookie set you get the page without any layout until you refresh. ??? here is tthe code <?php include('db_theme.php'); //echo("$dir_c $path_c" ); $predefinito_query=mysql_query("SELECT * FROM $temi WHERE predefinito='1'"); $row_predefinito=mysql_fetch_assoc($predefinito_query); $num_temi=mysql_query("SELECT * FROM $temi WHERE attivo='1'"); $total_skins = mysql_num_rows($num_temi); $default_skin = $row_predefinito['nr_tema']; $temi_attivi=mysql_fetch_assoc($num_temi); if (isset($_REQUEST['newskin'])) { $new_skin=$_REQUEST['newskin']; $skin_query=mysql_query("SELECT * FROM $temi WHERE nr_tema=$new_skin"); $skin_request=mysql_fetch_assoc($skin_query); if ($skin_request['attivo'] == '1') { $newskin = $skin_request['nr_tema']; } else { $newskin = $default_skin; } } elseif (isset($_COOKIE['skin'])) { $cookie_skin=$_COOKIE['skin']; $cookie_request=mysql_query("SELECT * FROM $temi WHERE nr_tema=$cookie_skin"); $cookieskin=mysql_fetch_assoc($cookie_request); if ($cookieskin['attivo'] == '1') { $newskin = $cookieskin['nr_tema']; } else { $newskin = $default_skin; } } elseif (!isset($_COOKIE['skin'])|| ($_REQUEST['newskin'])) { $newskin = $default_skin; } setcookie ('skin', "", time() - 3600); setcookie('skin',$newskin,time()+(86400*365),"$dir_c"); setcookie('skin',$newskin,time()+(86400*365),"$dir_c","$path_c"); $mytheme=mysql_query("SELECT * FROM $temi WHERE nr_tema='$skin'"); if($theme=mysql_fetch_array($mytheme)){ $tema=$theme['header']; $footer=$theme['footer'];} else {?> <br> <br> If the skin you've chosen doesn't show try to refresh the page by hitting F5 on your keyboard or the Refresh button on your browser. If the problem persists please contact me. <? } ?> It's the first time I use cookies, I probably don't know how to use them in the right way. I've checked the cookie too: is it normal that it shows Saturday April 26th as an expiry date? Thanks for any help
  3. Thanks for the answers Yes I know the code is repeated twice, but for some reason if you write it only once nothing works :/ I've tried printing out the variables, they work correctly. I really can't figure out the mistake I'm making. I'll try again deleting the repeated part of the code however . As to the sessions, I need cookies because I want the chosen layout to be set "permanently", so that the user doesn't have to choose a layout every time they visit the site.
  4. Hi! I have a little problem with a script which should manage the themes of my site. The script is meant to retrieve the info of the layouts from a mysql table, write a cookie and check if the cookie exists. If it exists it must use the layout from the cookie, if it doesn't exist it must use a default layout. So far so good, but... when I select a new layout, nothing happens until I refresh the page and sometimes, if no cookie is set yet you get no layout until you refresh! this is the code: include_once("db_theme.php"); $num_temi=mysql_query ("SELECT * FROM $temi"); $total_skins=mysql_num_rows($num_temi); /*$query="SELECT * FROM $temi WHERE predefinito='1'"; $result=mysql_query($query); if($row=mysql_fetch_array($result)){ $default_skin= $row['nr_tema'] ;} else {?> non è stato definito alcun tema di default <? }*/ $skin_cookie=$_COOKIE['skin']; $new_skin=mysql_query("SELECT * FROM $temi WHERE nr_tema='$skin_cookie'"); $skin_request=$_REQUEST['newskin']; $new_skin_request=mysql_query("SELECT * FROM $temi WHERE nr_tema='$skin_request'"); if (isset($_REQUEST['newskin'])) { $newskin=(int)$_REQUEST['newskin']; if (mysql_num_rows($new_skin_request) <= 0) $newskin=$default_skin; } elseif (isset($_COOKIE['skin'])) { $newskin=(int)$skin; if (mysql_num_rows($new_skin) <= 0) $newskin=$default_skin; } else $newskin=$default_skin; $skin=$newskin; setcookie ($cookie, "", time() - 3600); setcookie($cookie,$newskin,time()+(86400*365),$dir,$path); setcookie($cookie,$newskin,time()+(86400*365),$dir,$path); $skin=$newskin; $mytheme=mysql_query("SELECT * FROM $temi WHERE nr_tema='$newskin'"); if($theme=mysql_fetch_array($mytheme)){ $tema=$theme['header']; $footer=$theme['footer'];} else {?> errore <? } $num_temi=mysql_query ("SELECT * FROM $temi"); $total_skins=mysql_num_rows($num_temi); /*$query="SELECT * FROM $temi WHERE predefinito='1'"; $result=mysql_query($query); if($row=mysql_fetch_array($result)){ $default_skin= $row['nr_tema'] ;} else {?> non è stato definito alcun tema di default <? }*/ if (isset($_REQUEST['newskin'])) { $newskin=(int)$_REQUEST['newskin']; if (mysql_num_rows($new_skin_request) <= 0) $newskin=$default_skin; } elseif (isset($_COOKIE['skin'])) { $newskin=(int)$skin; if (mysql_num_rows($new_skin) <= 0) $newskin=$default_skin; } else $newskin=$default_skin; $skin=$newskin; setcookie ($cookie, "", time() - 3600); setcookie($cookie,$newskin,time()+(86400*365),$dir,$path); setcookie($cookie,$newskin,time()+(86400*365),$dir,$path); $skin=$newskin; $mytheme=mysql_query("SELECT * FROM $temi WHERE nr_tema='$newskin'"); if($theme=mysql_fetch_array($mytheme)){ $tema=$theme['header']; $footer=$theme['footer'];} else {?> errore <? } ?> and this is the table `id` int(11) NOT NULL auto_increment, `nr_tema` int(11) NOT NULL default '0', `nome` varchar(255) default NULL, `descrizione` text, `info` text, `header` varchar(255) NOT NULL default '', `footer` varchar(255) NOT NULL default '', `predefinito` tinyint(1) NOT NULL default '0', `cap_small` varchar(255) default NULL, `cap_big` varchar(255) default NULL, `date_added` int(11) NOT NULL default '0', PRIMARY KEY (`id`) what I need is that the layout shows immediately this is the site http://www.nakuru-club.com/index.php?newskin=3 (here in the box "skins" you have the possibility to switch layouts, in the "current layout there isn't this possibility, but you can do it by adding ?newskin=3, and ?newskin=1 for the "green" layout which is the current default one) thanks for any help.
  5. Hi, I have a question for all you phpers  :) A friend of mine has made a little php page which read an xml file output by a program. Now in this file there are numers preceded by this sign '^' what he would like to do is assign each number a different color so that the text following it takes that color e.g. ^1 = red ^2 = green etc... if we have ^1TEXT this should show [color=red]TEXT[/color] so how do we tell php that ^1 = red and that the output should be [code]<font color="red">TEXT</font>[/code] ? I know this is not clear, if you need to see the pages I'm talking about they're here: http://warsow.itlanet.net/master.xml http://warsow.itlanet.net/master.php thanks for any help  :)
  6. thanks for letting me know! I'll try and fix it :)
  7. ouch [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] ! this remained from a previous version of the page (I had three different pages in the file that where called via a file.php?page type of query) Now it works perfectly [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Anyway, it seems that I can't nest switches, can I? I mean, if I have more pages on a file and I also want to have a page where I change images like this, I can't ? Thanks again !!!
  8. That's what confuses me too [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] I usually use switches in my sites and I've done some scripts, that thanks to phpfreaks forum work perfectly and now I can't seem to change an image on a page [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] btw, here's the complete page: [code]<? // include("header.php") ?> <? if(!$_SERVER['QUERY_STRING']) { ?> <div id="text" class="chroma">  <table>     <tr>       <td> <h1>Gunther dei Roeri</h1></td>     </tr>     <tr>       <td><? switch($_GET['id']) {               case '1': $image="ras2.jpg"; break;               case '2': $image="ras5.jpg"; break;               case '3': $image="ras3.jpg"; break;                default: $image="ras2.jpg"; break;              } ?>                 <img src="immagini/allevamento/<?=$image?>" alt="Gunther dei Roeri" width="310" height="260" />       </td>     </tr>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">Data di Nascita : 09/05/1999</td>     </tr>     <tr>       <td class="dettagli">Padre  : &nbsp;Ch. David del Colle dell'Infinito<br>   Madre  : Glenda dei Roeri</td>     </tr>     <tr>       <td class="dettagli">Allevatore : Allevamento dei Roeri </td>     </tr>     <tr>       <td class="dettagli">Proprietario : Ruben Maschio</td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">Altre Foto <a href="gunter.php?id=1">1</a> <a href="gunther.php?id=2">2</a> <a href="gunther.php?id=3">3 </a></td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli"><a href="m_pedigree.php?gunther" onClick="return popup(this, 'notes')">Pedigree</a></td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">HD 0<br>   Esente da Spondilosi e Cardiopatie<br></td>     </tr>     <tr>       <td class="dettagli">CAL3, IPO1, ZTP, selezionato a vita<br /> A Bundesjugendsieger austriaco nel 2000<br /> 1&deg; Eccellente, migliore di razza <br /> 2&deg; ATIBOX Giovani Portogallo nel 2000<br /> 2&deg; Campione Giovane Mondiali di Milano 2000<br /> Campione Internazionale I.O. </td>     </tr>     <tr>       <td><div align="center"><a href="m_pedigree.php?gunther" onClick="return popup(this, 'notes')"></a></div>               <div align="center"><a href="gunther.php?foto">FOTO</a></div></td>     </tr>   </table>      <p>&nbsp; </p>     <p></p> </div> <? } include("footer.php") ?> [/code] in the header.php file there's the layout :)
  9. I've changed what you told me to, but everything's the same and the links to the images still result in blank pages :S Thenks for your patience!
  10. Here it is :) [code]<table>     <tr>       <td> <h1>Gunther dei Roeri</h1></td>     </tr>     <tr>       <td><? switch($_REQUEST['id']) {               case '1': $image="ras2.jpg"; break;               case '2': $image="ras5.jpg"; break;               case '3': $image="ras3.jpg"; break;                default: $image="ras2.jpg"; break;              } ?>                 <img src="immagini/allevamento/<?= $image; ?>" alt="Gunther dei Roeri" width="310" height="260" />       </td>     </tr>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">Data di Nascita : 09/05/1999</td>     </tr>     <tr>       <td class="dettagli">Padre  : &nbsp;Ch. David del Colle dell'Infinito<br>   Madre  : Glenda dei Roeri</td>     </tr>     <tr>       <td class="dettagli">Allevatore : Allevamento dei Roeri </td>     </tr>     <tr>       <td class="dettagli">Proprietario : Ruben Maschio</td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">Altre Foto <a href="gunter.php?id=1">1</a> <a href="gunther.php?id=2">2</a> <a href="gunther.php?id=3">3 </a></td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli"><a href="m_pedigree.php?gunther" onClick="return popup(this, 'notes')">Pedigree</a></td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">HD 0<br>   Esente da Spondilosi e Cardiopatie<br></td>     </tr>     <tr>       <td class="dettagli">CAL3, IPO1, ZTP, selezionato a vita<br /> A Bundesjugendsieger austriaco nel 2000<br /> 1&deg; Eccellente, migliore di razza <br /> 2&deg; ATIBOX Giovani Portogallo nel 2000<br /> 2&deg; Campione Giovane Mondiali di Milano 2000<br /> Campione Internazionale I.O. </td>     </tr>     <tr>       <td><div align="center"><a href="m_pedigree.php?gunther" onClick="return popup(this, 'notes')"></a></div>               <div align="center"><a href="gunther.php?foto">FOTO</a></div></td>     </tr>   </table>[/code] and [a href=\"http://lnx.boxerdellabraidola.com/gunther.php\" target=\"_blank\"]here's[/a] what happens. Probably I have written the requests for the images in a wrong way [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
  11. it doesn't work [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] maybe my links are wrong? I've linked the images like this: [code]<td class="dettagli">Photos<a href="gunter.php?id=1">1</a> <a href="gunther.php?id=2">2</a> <a href="gunther.php?id=3">3 </a></td>
  12. Hello everyone! I have a very simple question for you: how do I switch an image on a page while leaving everything else the same? I've tried this way, but it didn't work, I see the default page, but whenever I click on the links I get a blank page: [code] <table>     <tr>       <td> <h1>Gunther dei Roeri</h1></td>     </tr>     <tr>       <td><? switch($_REQUEST['id']) { default: ?>       <img src="immagini/allevamento/ras2.jpg" alt="Gunther dei Roeri" width="310" height="260" />       <? break;                    case '1': ?>       <img src="immagini/allevamento/ras2.jpg" alt="Gunther dei Roeri" width="310" height="260" />       <? break;              case '2': ?>       <img src="immagini/allevamento/ras5.jpg" alt="Gunther dei Roeri" width="310" height="260" />       <? break;        case '3': ?>       <img src="immagini/allevamento/ras3.jpg" alt="Gunther dei Roeri" width="310" height="260" /><? break; }  ?>       </td>     </tr>     <tr>       <td class="dettagli">&nbsp;</td>     </tr>     <tr>       <td class="dettagli">DOB: ######</td>     </tr>     <tr>       <td class="dettagli">Sire  : &nbsp;Ch. David del Colle dell'Infinito<br>   Dam  : Glenda dei Roeri</td>     </tr> ........ </table>[/code] If you need to see the page: [a href=\"http://lnx.boxerdellabraidola.com/gunther.php\" target=\"_blank\"]it's here[/a] (it's just a test, of course [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Thanks for any help
  13. Wow! As usual thanks Barand, your help is always precious :) I've tested the code and it works like magic. Btw, I understoon what that "set" meant: not a command hey? just meant I had to declare $last_cat= etc...!!! I'm extra slow, but I understand things...sometimes :D Thanks again! I'm changing LEFT JOIN with INNER JOIN now :)
  14. Well, I used left join because I want to get the name of the categories. No, I prefer not to show categories with no items. Now I'm trying to write the code following your directions, as I have a problem with the set command (it's the first time I "meet" it :) ) [code] $last_cat = ''; while ($row=mysql_fetch_assoc($query)) {            if ($last_cat != $row['id_cat']) {                  echo $row['nome_c']; #output category name                  set $last_cat = $row['id_cat']; #set category : is this syntax correct?           } #end if            echo $row['titolo']; # output title of the article } #end while[/code] Is this what I have to do? Thanks a lot for your help and patience!
  15. ok, I've tried and tried to figure this out, but I'm not able to. I'm pretty sure it's easy, but, as I'm not a php expert I really don't understand how to do this. I have a table recording categories and one recording articles, their relation is the category id (id_cat) my query is [code]$articoli=mysql_query("SELECT * FROM sayit_news n LEFT JOIN sayit_categorie c ON n.id_cat = c.id_cat GROUP BY n.id_cat ORDER BY n.titolo")     or die(mysql_error());[/code] now the problem is this: how do I display the results like this: Category 1: - article1 - article2 - article3 ... Category 2: - art1 - ... and so on? Thanks for any help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.