Jump to content

lordrt

Members
  • Posts

    28
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

lordrt's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, anyone can help me with the steps involved in creating an image gallery using PHP and MYSQL, where thumbnails of the original images are also created, and the images change after a specific interval? My files are uploaded to a folder "upload" on the server, while also stored in a table named FILE on my database, where the structure is as follows: IDFile, IDFileDirectory, Name, Extend, Size, FinalName (jpg or png) (a unique name, e.g. 1090291.jpg)
  2. managed to solve it, had got one of the variable wrongly named, thus the cause of errors
  3. hello, I have the following code written very long ago by another person, where the aim is to get the parent child hierarchy to build a sitemap. However, I need to modify this code so that it can display the hierarchy as parent-child-subchild, and so far all attempts have failed on my side. I could only get to the display of the child, by uncommenting the code echo $childMenu['TITLE'] at the end of this code, but am not able to get to display the subchild with its link. I tried to do another for loop using the childMenu part but ended up with many errors. anyone can help me with this? <div id="map-view"> <table class="map-view"> <thead> <tr> <?php //show primary menus foreach($rootMenus as $rootMenu) { $item = cGetItemMenu($_SESSION['IDLANG'], $rootMenu['IDMENU']); ?> <th> <?php if($item != null) { switch($item[0]['IDITEMTYPE']) { case 5: ?> <a href="#" onclick="<?php echo $item[0]['CONTENT'];?>"><?php echo $rootMenu['TITLE']; ?></a> <?php break; case 6: //get info if module module $infoModule = cGetInfoModClients($item[0]['IDLINK']); // check if page exist if(!empty($infoModule)) { // On contrôle que c'est bien un module switch($infoModule[0]['CODE']) { case "PATHCONTROLLER" : echo getURLRewriting($item[0]['IDITEMTYPE'], $_SESSION['IDLANG'], $infoModule[0]['IDCLIENTMODULE'], $infoModule[0]['NAME'], $rootMenu['TITLE']); break; case "JSPOPUP" : ?> <a href="#" onclick="<?php echo $infoModule[0]['ACTION'];?>"><?php echo $rootMenu['TITLE']; ?></a> <?php break; } } break; default: echo getURLRewriting($item[0]['IDITEMTYPE'], $_SESSION['IDLANG'], $item[0]['IDITEM'], $item[0]['TITLETRANSLATION'], $rootMenu['TITLE']); break; } } else { echo $rootMenu['TITLE']; } ?> </th> <?php } ?> </tr> <!--end row for primary menus--> </thead> <tbody> <tr> <?php //get child menus of primary menus foreach($rootMenus as $rootMenu) { ?> <td> <?php $childMenus = cGetMenus($idLang, 1, $rootMenu['IDMENU']); if(!empty($childMenus) && $childMenus != NULL) { ?> <table> <?php foreach($childMenus as $childMenu) { $itemChildMenu = cGetItemMenu($_SESSION['IDLANG'], $childMenu['IDMENU']); ?> <tr> <td> <?php if($itemChildMenu != null) { switch($itemChildMenu[0]['IDITEMTYPE']) { case 5: ?> <a href="#" onclick="<?php echo $itemChildMenu[0]['CONTENT'];?>"><?php echo $childMenu['TITLE']; ?></a> <?php break; default: echo getURLRewriting($itemChildMenu[0]['IDITEMTYPE'], $_SESSION['IDLANG'], $itemChildMenu[0]['IDITEM'], $itemChildMenu[0]['TITLETRANSLATION'], $childMenu['TITLE']); break; } } else { //echo $childMenu['TITLE']."<br />"; } ?> </td> </tr> <?php } ?> </table> <?php } ?> </td> <?php } ?> </tr> </tbody> </table> </div> </div>
  4. thanks both codes worked for me, but i went for mac_gyver's one which was more suited to the issue i was having
  5. Hello, I need some help in re-writing a code concerning the display of menus, where I will require to show several levels in the menu hierarchy. So far, I have a code, which was written long ago by another colleague (see attachment), where it can retrieve the "primary" menus, along with the children if any, but only upto one level, e.g. Parent Menu -> Child Menu However I would like to make the code retrieve all the levels, irrespective of the number, and show them, for e.g. Parent Menu -> Child Menu -> Sub-child Menu -> Sub-sub Child Menu and so on. Anyone can help me pls? menus.php
  6. thx gizmola and resting, will have a look at them but I think will go for Xdebug
  7. seems you missed a semi-colon after clear:both yours: .clearer { clear:both } correct: .clearer { clear:both; }
  8. Hi everyone, am looking for a php debugging software (freeware as far as possible) which would help me in finding errors etc in my php scripts/files. Anyone have an idea
  9. Hello all Am trying to modify a php template for my website, which has multilanguage support. I in fact have to use 2 logos, one for each language french and german, and am using drupal to create the site. the following code is taken from a file called page.tpl.php <div id="logo-floater"> <h1> <a href="<?php print check_url($front_page); ?>"> <?php if ($logo): ?> <img src="<?php print check_url($logo); ?>" title="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" alt="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" id="logo" /> <?php endif; ?> can anyone pls explain me this part of code, what it is doing really?
  10. Am using the following script to parse data from a csv, but the trouble is that a 2 single quote string is becoming a single quoted one: script calling csv: <?php // import php file: import_article.php require("import_article.php"); mysql_connect("127.0.0.1", "root", "") or die (mysql_error()); mysql_select_db("drupal_zenhaeusern") or die (mysql_error()); // read first .csv file encountered $path = "sites/path/files/"; $sfile = "*.csv"; foreach (glob($path.$sfile) as $filename){ echo $filename . "<br/>"; $file = fopen($filename, 'r'); while (($data = fgetcsv($file, 0, ",", "'")) !== False) { //$data = str_replace("'", " ", $data); foreach ($data as $k => $v) { //$data[$k] = ltrim($v, "'"); //$data[$k] = rtrim($v, "'"); echo htmlentities($data[$k], ENT_QUOTES)."\n"; } //$data = implode(" ", $data); //echo $data[0] ."\n". $data[1] ."\n". $data[2] ."\n". $data[3] ."\n". $data[4] ."\n". $data[5] ."\n". $data[6]. "<br/>"; //echo $data ."\n"; ImportArticle($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6]); } echo "read complete"; fclose($file); // unlink ($filename); } echo "closing connection"; mysql_close(); ?> DAta from csv browser return value: As seen above, the red colored quote in the insert part is only single quote, while it should have been as in the csv file one, with only the start and end quotes of each data removed , and thus is not inserting in the table
  11. found the mistake, should have commented the implode part
  12. A small qu yet again Since am using $data[0]. $data[1]. $data[2]. $data[3]. $data[4]. $data[5]. $data[6], will the foreach part have to be changed??
  13. I have a csv file which contains data in the following format: '<p>Hamburger nature 45</p>', 'img src= "some path"', .... These data will be stored in a mysql db, and am using the following test code to read and display csv data in my browser: <?php // import php file: import_article.php require("import_article.php"); // read first .csv file encountered $path = "sites/path/files/"; $sfile = "*.csv"; foreach (glob($path.$sfile) as $filename){ echo $filename . "<br/>"; $file = fopen($filename, 'r'); while (($data = fgetcsv($file, 0, ",", "'")) !== False) { //$data = str_replace("'", " ", $data); echo $data[0]. $data[1]. $data[2]. $data[3]. $data[4]. $data[5]. $data[6]. "<br/>"; } echo "read complete"; fclose($file); // unlink ($filename); } // echo "closing connection"; // mysql_close(); ?> I however have been asked to strip the whitespaces present, I investigated trim() for this, and now have to read first and last chars, if they are single quotes, replace them with blank values, and if using french words, like l'église, the ' must not be removed as it forms part of the data. Can anyone help me with the part to read first and last chars and if ' remove them?? :-\ Also need to cater for the commas present and remove them as well...
×
×
  • 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.