
perik
New Members-
Posts
6 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
perik's Achievements

Newbie (1/5)
0
Reputation
-
Hi! Im using an random image script which works fine but that I want to edit a bit. I have edited it a bit so when you click on a image you get a fullsize in a popup. The problem is that the image in the popup is also random and not always a bigger copy of the thumbnail, the smaller one you clicked on as I want: see it live here, and I think you will understand what I want to achieve: see it here the code Im using is: randim.php <?php /* The default folder with images */ $settings['img_folder'] = 'bildermini/'; /* File types (extensions) to display */ $settings['img_ext'] = array('.jpg','.gif','.png'); /* How to display the images? 0 = print just the image path (for includes), like: images/test.jpg 1 = redirect to the image, when using: <img src="randim.php" /> */ $settings['display_type'] = 1; /* Allow on-the-fly settings override? 0 = NO, 1 = YES */ $settings['allow_otf'] = 1; /******************************************************************************* /* Override type? */ if ($settings['allow_otf'] && isset($_GET['type'])) { $type = intval($_GET['type']); } else { $type = $settings['display_type']; } /* Override images folder? */ if ($settings['allow_otf'] && isset($_GET['folder'])) { $folder = htmlspecialchars(trim($_GET['folder'])); if (!is_dir($folder)) { $folder = $settings['img_folder']; } } else { $folder = $settings['img_folder']; } /* Make sure images fodler ends with an '/' */ if (substr($folder,-1) != '/') { $folder.='/'; } /* Get a list of all the image files */ $flist = array(); foreach($settings['img_ext'] as $ext) { $tmp = glob($folder.'*'.$ext); if (is_array($tmp)) { $flist = array_merge($flist,$tmp); } } /* If we have any images choose a random one, otherwise select the "noimg.gif" image */ if (count($flist)) { $src = $flist[array_rand($flist)]; } else { $src = 'noimg.gif'; } /* Output the image according to the selected type */ if ($type) { header('Location:'.$src); exit(); } else { echo $src; } ?> and for calling 3 random images: test.php <ol> click for bigger image: <li> <a class="fancy" rel="fancy" href="<?php $_GET['type']=0; $_GET['folder']='bilderstora'; include 'randim.php'; ?>"><img border='0' src="<?php $_GET['type']=0; $_GET['folder']='bildermini'; include 'randim.php'; ?>"></a></p> </li> <li> <a class="fancy" rel="fancy" href="<?php $_GET['type']=0; $_GET['folder']='bilderstora'; include 'randim.php'; ?>"><img border='0' src="<?php $_GET['type']=0; $_GET['folder']='bildermini'; include 'randim.php'; ?>"></a></p> </li> <li> <a class="fancy" rel="fancy" href="<?php $_GET['type']=0; $_GET['folder']='bilderstora'; include 'randim.php'; ?>"><img border='0' src="<?php $_GET['type']=0; $_GET['folder']='bildermini'; include 'randim.php'; ?>"></a></p> </li> </ol> how do I edit the code so I get the same image on the link as it is on the thumbnail? the images are stored in: bildermini/ (thumbnails) bilderstora/ (big image) thanks for your help! Perik
-
I have now changed this in the code name='project_body[]' with new code: // FROM $projectmenu_selcatNY = ''; if ($sql->db_Select('user', 'user_id, user_name', ' GROUP BY user_id', 'nowhere', false)) { while ($projectmenu_row = $sql->db_Fetch()) { extract($projectmenu_row); $projectmenu_selcatNY .= "$user_name<input type='checkbox' name='project_body[]' value='$user_name'<br "; if ($user_id == $projectmenu_projectcat) { } $projectmenu_selcatNY .= '>' . $tp->toFORM($projectmenu_bortmedborjan2[2], false) . '</option>'; } } $projectmenu_selcatNY .= '</select>'; // TO when Im checking a name in the user list it will now registrate the word "Array" in the database instead. how do I use arrays and write the code so it writes several names like: in the database instead of Array or overwriting the names? as you probably understand Im a newbie in php Thanks for your help!
-
Hi! I have a page built in php for different projects within culture and arts. In one part of the page the members of the page can presentate their projects. In this part I would like to have a userlist with the possibility to check which other members you have collaborated with in different projects like in the picture below. The problem is when I check several checkboxes there will still just show up one collaboration on the page. Heres an more detailed explanation: I get the this userlist with the code: // FROM $projectmenu_selcatNY = ''; if ($sql->db_Select('user', 'user_id, user_name', ' GROUP BY user_id', 'nowhere', false)) { while ($projectmenu_row = $sql->db_Fetch()) { extract($projectmenu_row); $projectmenu_selcatNY .= "$user_name<input type='checkbox' name='project_body' value='$user_name $user_id'<br "; if ($user_id == $projectmenu_projectcat) { } $projectmenu_selcatNY .= '>' . $tp->toFORM($projectmenu_bortmedborjan2[2], false) . '</option>'; } } $projectmenu_selcatNY .= '</select>'; // TO 2) And this results in a page like below with lists of the collaborations that are checked in the list: With the code: SC_BEGIN project_VIEW_BODY global $tp,$user_id_project,$project_body,$user_id_project,$project_author,$projectmenu_postername,$user,$user_name,$projectmenu_postername; return "<a href='".e_BASE."user.php?id.$project_body'>$project_body</a>"; SC_END Where project_VIEW_BODY is a shortcode for a templatefile. And $project_body is the value from the checkbox. Heres is also a picture of the database: MY QUESTION: The problem is when I check several checkboxes there will still just show up one collaboration on the page. What shall I change in the code to be able to make several users to get registrated in the database? So if I for example check: It ends up with a database that looks like: Thanks a lot for help!!! Perik
-
solved it by changing: if ($sql->db_Select('projectmenu_projects', '*', ' order by project_author', 'nowhere', false)) to: if ($sql->db_Select('projectmenu_projects', 'project_author', ' GROUP BY project_author', 'nowhere', false)) The whole code is now: //FROM $projectmenu_selcat = ' <select class="tbox" name="projectmenu_select" onchange="this.form.submit()"> <option value="" >' . RCPEMENU_111 . '</option>'; // if ($sql->db_Select('projectmenu_projects', '*', ' order by project_author', 'nowhere', false)) if ($sql->db_Select('projectmenu_projects', 'project_author', ' GROUP BY project_author', 'nowhere', false)) { while ($projectmenu_row = $sql->db_Fetch()) { extract($projectmenu_row); $projectmenu_selcat .= "<option value='{$project_author}' "; if ($project_author == $projectmenu_projectcat) { $projectmenu_selcat .= ' selected="selected"'; $projectmenu_catname = $project_author; $projectmenu_where = "project_author='$projectmenu_projectcat'"; // if ($projectmenu_row['project_author_icon'] && file_exists('images/caticons/' . $projectmenu_row['project_author_icon'])) // { // $projectmenu_caticon = '<img src="images/caticons/' . $projectmenu_row['project_author_icon'] . '" style="border:0;" alt="" />'; // } } $projectmenu_bortmedborjan = explode(".", $projectmenu_row['project_author'], 2); // $projectmenu_lank = $tp->toFORM($projectmenu_bortmedborjan[1], false); $projectmenu_selcat .= '>' . $tp->toFORM($projectmenu_bortmedborjan[1], false) . '</option>'; } // while } // TO But now I would like to change so I get links instead of <option> menu so it displays like below: so links instead of the users that are displayed in option menu "Show by member:": any tips how? By the way in the picture of the phpmyadmin there have been some small namechangnings so just imagine that everywhere it says project there shall be recipe instead. Thanks a lot! Per
-
Hi! Im using a forum that is called e107 which is build in php. Im editing this plugin: http://plugins.keal.me.uk/plugins/recipe_menu/recipes.php and run into a problem. In the "Select Category" (see picture below) I succeded to list all the posts from a single author instead of categories by editing this code: $recipemenu_selcat = ' <select class="tbox" name="recipemenu_select" onchange="this.form.submit()"> <option value="" >' . RCPEMENU_111 . '</option>'; if ($sql->db_Select('recipemenu_category', '*', ' order by recipe_category_name', 'nowhere', false)) { while ($recipemenu_row = $sql->db_Fetch()) { extract($recipemenu_row); $recipemenu_selcat .= "<option value='{$recipe_category_id}' "; if ($recipe_category_id == $recipemenu_recipecat) { $recipemenu_selcat .= ' selected="selected"'; $recipe_catdesc = $recipe_category_description; $recipemenu_catname = $recipe_category_name; $recipemenu_where = "recipe_category='$recipemenu_recipecat'"; if ($recipemenu_row['recipe_category_icon'] && file_exists('images/caticons/' . $recipemenu_row['recipe_category_icon'])) { $recipemenu_caticon = '<img src="images/caticons/' . $recipemenu_row['recipe_category_icon'] . '" style="border:0;" alt="" />'; } } $recipemenu_selcat .= '>' . $tp->toFORM($recipe_category_name) . '</option>'; } // while } else { $recipemenu_selcat .= '<option value="0">' . RCPEMENU_4 . '</option>'; } $recipemenu_selcat .= '</select>'; into: // START CODE $recipemenu_selcat = ' <select class="tbox" name="recipemenu_select" onchange="this.form.submit()"> <option value="" >' . RCPEMENU_111 . '</option>'; if ($sql->db_Select('recipemenu_recipes', '*', ' order by recipe_author', 'nowhere', false)) { while ($recipemenu_row = $sql->db_Fetch()) { extract($recipemenu_row); $recipemenu_selcat .= "<option value='{$recipe_author}' "; if ($recipe_author == $recipemenu_recipecat) { $recipemenu_selcat .= ' selected="selected"'; $recipe_catdesc = $recipe_author_description; $recipemenu_catname = $recipe_author; $recipemenu_where = "recipe_author='$recipemenu_recipecat'"; if ($recipemenu_row['recipe_author_icon'] && file_exists('images/caticons/' . $recipemenu_row['recipe_author_icon'])) { $recipemenu_caticon = '<img src="images/caticons/' . $recipemenu_row['recipe_author_icon'] . '" style="border:0;" alt="" />'; } } $recipemenu_bortmedborjan = explode(".", $recipemenu_row['recipe_author'], 2); $recipemenu_lank = $tp->toFORM($recipemenu_bortmedborjan[1], false); $recipemenu_selcat .= '>' . $recipemenu_lank . '</option>'; } // while } else { $projectmenu_selcat .= '<option value="0">' . RCPEMENU_4 . '</option>'; } $projectmenu_selcat .= '</select>'; // END CODE what i basically did was to replace the recipe_category with recipe_author. The function works but the problem is that now I get a list that looks like this: as you can see the authors are repeating eachother. I just want the different authors to be displayed once. I was thinking to solve it by count the project_author in the project_author and if they where more than 1 i just displayed one but since im not very good in php I run into problems. This is what I tried anyway: $text = ""; $count_project_author = $sql->db_Count("projectmenu_projects", "*", "project_author", ?????); if($count_project_author > 1) echo $text; I know that would never work and the echo text and everything is not the right way but maybe if someone want to help to dig a bit deeper into this? Heres a picture from the database from phpmyadmin: thanks a lot! any help what so ever would be very much apreciated!!!
-
Hi! Im using the community e107 and want to hack one of their scripts. The script lists the content in alphabetic order. I would like to have max 10 results per page and then paginating with next and previous buttons. Something like this: < prev 1 2 3 … 9 10 11 next > How do I make this? Theres a shortcode in the e107 that is called NEXTPREV Heres an codeexample for this that Ive gotten from this page: http://wiki.e107.org/?title=Shortcodes:Frontend:NEXTPREV Shortcodes:Frontend:NEXTPREV From e107 Wiki This code is used to generate the next/previous buttons often found on pages that contain long listings from the database. The following example, will display 30 rows from the database on each page. $from = ($_GET['frm']) ? $_GET['frm'] : 0; $view = 30; $total = $sql -> db_Select("download", "*", "download_author='$usernm'"); $sql -> db_Select("download", "*", "download_author='$usernm' LIMIT $from,$view"); while($row = $sql-> db_Fetch()){ $text .= "text-here".$row['fieldname']; } $parms = $total_items.",".$view.",".$from.",".e_SELF.'?frm=[FROM]'; $text .= $tp->parseTemplate("{NEXTPREV={$parms}}"); echo $text; Ive tried to insert this into my page but it need to be modified but I cant figure out how. Or have you got any other code I can use. Heres the the code from the e107 file which lists the content in alphabetic order: <?php /* | This script lists content pages by alphabetical order with buttons for letters | Tested for v0.7.7 and it is originally adapted from v0.617: +---------------------------------------------------------------+ */ require_once("../../class2.php"); require_once(HEADERF); require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."userclass_class.php"); $lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_toc.php'; include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_toc.php'); // ##### Display scrolling list of existing content pages ------------------------------------ $text = ""; // -------- SHOW FIRST LETTERS FIRSTNAMES ------------------------------------ $sql = new db; $distinctfirstletter = $sql -> db_Select("pcontent", "DISTINCT(LEFT(content_heading,1)) as letter", "LEFT(content_parent,1)!='0' ORDER BY content_heading ASC "); if ($distinctfirstletter != 1){ $text .= "<form method='post' action='".e_SELF."'> <table class='fborder' style='width:100%'> <tr><td colspan='2' class='forumheader'>".CONTENT_TOC_LAN_3."</td></tr> <tr><td colspan='2' class='forumheader3'>"; while($row = $sql-> db_Fetch()){ extract($row); $text .= "<input class='button' style='width:20' type='submit' name='letter' value='".strtoupper($letter)."' />"; } $text .= " <input class='button' style='width:20' type='submit' name='letter' value='".CONTENT_TOC_LAN_6."' /> </td></tr> </table></form> "; } // --------------------------------------------------------------------------- // -------- CHECK FOR FIRST LETTER SUBMISSION -------------------------------- $sql = new db; $letter=$_POST['letter']; if ($_POST['letter'] != "" && $_POST['letter'] != CONTENT_TOC_LAN_6 ) { $letter = $_POST['letter']; $query = "LEFT(content_parent,1)!='0' AND content_heading LIKE '".$letter."%' ORDER BY content_heading ASC"; } else { $query = "LEFT(content_parent,1)!='0' ORDER BY content_heading ASC"; } // --------------------------------------------------------------------------- $sql2 = new db; $text .= "<div style='border : solid 1px #000; padding : 4px; width : auto; height : 600px; overflow : auto; '>"; if($article_total = $sql -> db_Select("pcontent", "*", $query)){ if($article_total < 50 || $letter || $cat){ $text .= "<table class='fborder' style='width:100%'> <tr> <td style='width:5%' class='forumheader2'> </td> <td style='width:95%' class='forumheader2'>".CONTENT_TOC_LAN_2."</td> </tr>"; while($row = $sql -> db_Fetch()){ extract($row); if(check_class($content_class)){ unset($cs); $delete_heading = str_replace("'", "\'", $content_heading); if($sql2 -> db_Select("pcontent", "content_heading", "content_id=$content_parent")){ $row = $sql2 -> db_Fetch(); $cs = $row[0]; } $text .= "<tr> <td style='width:5%; text-align:center' class='forumheader3'><img src='".e_PLUGIN."content/images/content_32.png' alt='' style='border:0' /></td> <td style='width:75%' class='forumheader3'><a href='".e_PLUGIN."content/content.php?content.$content_id'>$content_heading</a> </td> </td> </tr>"; } } $text .= "</table>"; } else { $text .= "<br /><div style='text-align:center'>".CONTENT_TOC_LAN_4."</div>"; } } else { $text .= "<div style='text-align:center'>".CONTENT_TOC_LAN_1."</div>"; } $text .= "</div>"; $caption = "".CONTENT_TOC_LAN_5."\n<a href='".e_PLUGIN."content/content.php?'>".CONTENT_TOC_LAN_7."</a>"; $ns -> tablerender($caption, $text); // ##### End --------------------------------------------------------------------------------------------------------------------------------------------------------------------- require_once(FOOTERF); ?> Ive replaced this line if($article_total = $sql -> db_Select("pcontent", "*", $query)){ into: $view = 10; if($article_total = $sql -> db_Select("pcontent", "*", "$query LIMIT $view")){ to limit the displayed content to 10 only. Any idea how I can insert paginating??? Thanks a lot Perik