PHP - Fackebook Like Box - Shorten Title?
Hello all,
I am using a simple iframe to include a facebook like box on my webpage. Code: [Select] <iframe src="http://www.facebook.com/plugins/likebox.php?id=<?php echo $pageID;?>&width=<?php echo $width;?>&colorscheme=<?php echo $colorScheme;?>&show_faces=<?php echo $showFaces;?>&connections=<?php echo $connection;?>&stream=<?php echo $streams;?>&header=<?php echo $header;?>&height=<?php echo $height;?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:<?php echo $width;?>px; height:<?php echo $height;?>px;" allowTransparency="true"></iframe> The problem is that I want to limit the title of the facebook page to 15 characters. Any ideas on how I could do this? Similar TutorialsHi everyone, I know im being really picky here, but im trying to optimize my code, and i was wondering if there is any way i can shorten the following: if ($submit) {echo $name;} else {echo $row['dbname'];} I know it fairly short already however im using it as the value of a html text box. Thanks Hi, When a user POSTS 10 maps (dropdown), I don't want any two or more being the same. From my knowledge, only way I know of doing this, is this very long messy way: Code: [Select] if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) etc... then I need to type if $_POST['map2']==$_POST['map1'] etc... How can I put this in its simplest form so that there are no POST duplicates? Thanks for any help. I need help to shorten the following url in apache .htaccess
example.com/index.php?q=1&w=2
if possible, the url that i would like is...
example.com/index.php/1/2
or better yet...
example.com/index/1/2
The $a variable contains the news text. The $link variable contains a link to the page with the full text of this news. change text hello, is it possible to get the 1274 out of the following? Code: [Select] $jobnumber='1009-1274R'; $shortnumber= (this is where i need it to be 1274); Hey all, I really like programming in PHP, but I'm still in the learning process. And mostly, I'm not that good in making my code short. This is now the case again. I have this code which gets a lot of checkboxes, only checkboxes, out of a mysql database, for a planning project. Now the code I have so far, retrieves the checkboxes, which are booleans in the database, and checks if they are True or False and sets the checkboxes respectively to checked="yes" or not. This code works. But I'm here to get tips on how to shorten my code, since it's very repetitive and thus long, which isn't quite efficient. As I said, I'm still in learning process, so I hope you guys understand that I'm looking for help with this. Thanks. EDIT: Okay, I now suddenly see, that I can use elsif for True and False. This would be logical to do, and I can accomplish this easily. But it would be still very repetitive. Here's the code: Code: (php) [Select] <?php while ($row = mysql_fetch_array($result)){ // UNCHECKED if ($row['fact-sent'] == false){ $fact_sent = '<input type="checkbox" />'; } if ($row['fact-payed'] == false){ $fact_payed = '<input type="checkbox" />'; } if ($row['domain'] == false){ $domain = '<input type="checkbox" />'; } if ($row['content'] == false){ $content = '<input type="checkbox" />'; } if ($row['design-sent'] == false){ $design_sent = '<input type="checkbox" />'; } if ($row['design-approved'] == false){ $design_approved = '<input type="checkbox" />'; } if ($row['design-sliced'] == false){ $design_sliced = '<input type="checkbox" />'; } if ($row['temp-website'] == false){ $temp_website = '<input type="checkbox" />'; } if ($row['temp-website-sent'] == false){ $temp_website_sent = '<input type="checkbox" />'; } if ($row['temp-website-approved'] == false){ $temp_website_approved = '<input type="checkbox" />'; } if ($row['cms'] == false){ $cms = '<input type="checkbox" />'; } if ($row['seo'] == false){ $seo = '<input type="checkbox" />'; } if ($row['analytics'] == false){ $analytics = '<input type="checkbox" />'; } if ($row['webmaster-tools'] == false){ $webmaster_tools = '<input type="checkbox" />'; } if ($row['website'] == false){ $website = '<input type="checkbox" />'; } if ($row['website-online'] == false){ $website_online = '<input type="checkbox" />'; } // CHECKED if ($row['fact-sent'] == true){ $fact_sent = '<input type="checkbox" checked="yes" />'; } if ($row['fact-payed'] == true){ $fact_payed = '<input type="checkbox" checked="yes" />'; } if ($row['domain'] == true){ $domain = '<input type="checkbox" checked="yes" />'; } if ($row['content'] == true){ $content = '<input type="checkbox" checked="yes" />'; } if ($row['design-sent'] == true){ $design_sent = '<input type="checkbox" checked="yes" />'; } if ($row['design-approved'] == true){ $design_approved = '<input type="checkbox" checked="yes" />'; } if ($row['design-sliced'] == true){ $design_sliced = '<input type="checkbox" checked="yes" />'; } if ($row['temp-website'] == true){ $temp_website = '<input type="checkbox" checked="yes" />'; } if ($row['temp-website-sent'] == true){ $temp_website_sent = '<input type="checkbox" checked="yes" />'; } if ($row['temp-website-approved'] == true){ $temp_website_approved = '<input type="checkbox" checked="yes" />'; } if ($row['cms'] == true){ $cms = '<input type="checkbox" checked="yes" />'; } if ($row['seo'] == true){ $seo = '<input type="checkbox" checked="yes" />'; } if ($row['analytics'] == true){ $analytics = '<input type="checkbox" checked="yes" />'; } if ($row['webmaster-tools'] == true){ $webmaster_tools = '<input type="checkbox" checked="yes" />'; } if ($row['website'] == true){ $website = '<input type="checkbox" checked="yes" />'; } if ($row['website-online'] == true){ $website_online = '<input type="checkbox" checked="yes" />'; } // OUTPUT echo '<tr><td class="customer">'.$row['project'].'</td><td class="customer">'.$row['customer'].'</td><td class="data">'.$fact_sent.'</td><td class="data">'.$fact_payed.'</td><td class="data">'.$domain.'</td><td class="data">'.$content.'</td><td class="data">'.$design_sent.'</td><td class="data">'.$design_approved.'</td><td class="data">'.$design_sliced.'</td><td class="data">'.$temp_website.'</td><td class="data">'.$temp_website_sent.'</td><td class="data">'.$temp_website_approved.'</td><td class="data">'.$cms.'</td><td class="data">'.$seo.'</td><td class="data">'.$analytics.'</td><td class="data">'.$webmaster_tools.'</td><td class="data">'.$website.'</td><td class="data">'.$website_online.'</td></tr>'; } ?> Hi all, im trying to shorten this string which cnotains about 1000 characters, to say 250 Code: [Select] <?php echo $row_Best_Sellers['experience_name']; ?> Ive tried using the below to no avail, can anybody give me some advice? Code: [Select] <?PHP $small = some_function($row_Best_Sellers['experience_description']); echo $small; function some_function($string){ $string = substr($string,0,100); $string = substr($string,0,strrpos($string," ")); return $string; } ?> Hello everyone For a site of one of our customers our programmer created his own CMS which works OK at the site, but now the customer wants to shorten the URLS which are generated by the system. Is this easily possible? The programmer doesn't have the time to help us with it so that's why I try my luck here... I hope somebody can help me. Thanks! Ok, I have a log file that is written to. I only want the text file to have the last fifty lines (\n) delimited So, how do I make it delete the excess from the TOP of the file? So if it had 60 lines, I would want it to only have lines 10-60 to net 50 total. Thanks. Hello, I am assigned a task to make alterations on a client website. The header is an include on all pages. Inside the header is the title tag which propogate to all pages. I want title different to each page, I will also add description and keyword. Is there a way to do this with PHP or should I have different header for each page. thank you Hi guys, this is my problem. I use wordpress and i have diffrent titles for every post. The php code for the title is <?php the_title(); ?> I want to add my title after this url: http://search.msn.com/results.aspx?format=rss&FORM=RSRE&q= That means if i have a post with this title: php tutorials The url should be like this: http://search.msn.com/results.aspx?format=rss&FORM=RSRE&q=php+tutorials This is the part of my php code that contains the url: <?php $url="http://search.msn.com/results.aspx?format=rss&FORM=RSRE&q=php+tutorials"; $rss=new rssFeed($url); I tried this already but it is not working: <?php $url="http://search.msn.com/results.aspx?format=rss&FORM=RSRE&q=<?php the_title(); ?>"; $rss=new rssFeed($url); Sorry, i hope you understand what i mean. I've tried mysql_error(), yet nothing is displayed, but I'm pretty sure it may be something wrong with my query. After someone inputs their new information, site title in the database is changed to 0, and description isn't updated at all.., but it's still the same data as before and isn't changed. if(!$_POST['title'] || !$_POST['description']) { echo " <table><form action='account.php' method='POST'> <input type='hidden' name='edit' value='1'> <tr><td>Site Name</td><td><input type='text' name='title' value='". $grab['title'] ."'></td></tr> <tr><td>Site Description</td><td><textarea name='description' rows='18' cols='40' maxlength='550'>". $grab['description'] ."</textarea></td></tr> <tr><td>Finished?</td><td><input type='submit' value='Update Information'></td></tr> </form></table>"; } else { $title = mysql_real_escape_string(strip_tags($_POST['title'])); $description = mysql_real_escape_string($_POST['description']); $to_censor = array("fag", "ass", "asshole", "douchebag", "dumbass"); $new = str_replace($to_censor, "****", $description); $description = strip_tags($new, "<b><i><a>"); mysql_query("UPDATE sites SET title = '$title' AND description = '$description' WHERE username = '". $_SESSION['user'] ."'") or die(mysql_error()); echo "Updated information successfully. <a href='account.php'>Back to My Account</a>"; } Code: [Select] Echo "<img src='http://datenight.netne.net/images/".$info['img'] ."'title='.info['username']'"."' width='50' height='50'>"; im trying display the user's, username in the title when the mouse hovers over the img it displays the username of that image. no errors just displays .info as title thanks [/code] Hello - I have a search page that displays urls to a details page. Currently, the url looks like this: ".com/loc_details.php?loc_id=38" but I would like it to have the contents of the 'loc_name' field display after the id. Here is how it's being called in the code: Code: [Select] $output .= "<td><a href='loc_details.php?loc_id={$row['loc_id']}'>{$row['loc_name']}</a></td>\n"; The only thing I can think of to compare it to would be the pretty links that Wordpress offers. The website for reference is www.giantstridedives.com/locations, so you can see it in action. Thanks for any help! Trying to figure this out... Code: [Select] <?php echo get_the_title(); ?> works to display my wordpress post title on the page. how can I echo that inside this code? Code: [Select] <?php if (function_exists('simple_feed_list')) : ?> <?php simple_feed_list('I WANT TO ECHO TITLE HERE'); ?> <?php endif; ?> I've got this code Code: [Select] <{assign var="title" value=$people->getTitle()|cat:" "|cat:$people->getName()|cat:" | Sea.com"}> How do I write some text fx. 'visit' in the beginning of the title value? Tried to do it like this Code: [Select] <{assign var="title" value=Visit $people->getTitle()|cat:" "|cat:$people->getName()|cat:" | Sea.com"}>But then I get an error. Any help mych appriciated I'm displaying a row of images but I can't seem to get the title to stay under the image. When I try to insert a <br> or <br /> the the $item_title, it changes the whole dynamics of the row, placing the $item_title next to the image rather than under it. Here is the code: $image_row .= "<tr height=\"200\"><td ><img src=\"image_files/{$item_photo}\" alt=\"{$item_name}\" /><br />{$item_title} </td></tr> </table>"; On one of my pages I set the title like this Code: [Select] <{assign var="title" value=$people->getShow()|escape}> The problem is I want the title to say getShow and getName Tried to do it like this but I get an internal 500 error Code: [Select] <{assign var="title" value=$people->getShow()|escape}$people->getName()|escape}> How can I make this work? Thanks in advance I know this topic is everywhere but I cant find a solution to my particular problem. I have been using a download center script for about a year. http://download.redgalaxy.net/ However, the title is static, keeping with the predefined one. I am trying to get the title to change so it matches the file name shown on the display page "index.php/?nav=display&file=25". I have spent days trying to figure something out with absolutely no luck. Does anyone have an idea how to get the title to change when dynamically? Out of desperation i used an onload javascript but it doesnt work with crawlers. Thank you in advanced. Index.php <?php /* PHP Download Center Copyright (C) 2007 Chris LaPointe This program is free softwa you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //error_reporting(E_ERROR); define("PHP_DOWNLOADCENTER", 1); include_once('settings.php'); //Include all files in 'inc' directory $path = 'inc/'; $handle = opendir($path); while (false !== ($file = readdir($handle))) { if (substr($file, 0, 1) != '.') include($path.$file); } closedir($handle); //Start session for me! session_start(); if (mysql_connect($mysql_host, $mysql_username, $mysql_password) == FALSE){ if (file_exists("install.php")){ echo '<HTML><HEAD><meta http-equiv="refresh" content="0;url=install.php"></HEAD></HTML>'; exit; }else{ die("Fatal error. Unable to access database. In addition, unable to go to install.php to setup access!"); } } if (mysql_select_db($mysql_database) == FALSE){ if (file_exists("install.php")){ echo '<HTML><HEAD><meta http-equiv="refresh" content="0;url=install.php"></HEAD></HTML>'; exit; }else{ die("Fatal error. Unable to access database. In addition, unable to go to install.php to setup access!"); } } //because of the way it is handled, there should never be any HTML passed via arguments //do a check here foreach ($_GET as $key => $value){ $_GET[$key] = strip_tags(html_entity_decode($value, ENT_NOQUOTES), '<i><b>'); } //Run the now (Just code, ie login code) if ( isset($_GET['now']) ){ $nowfile = "pages/".$_GET['now'].'.now.php'; if (file_exists($nowfile)){ include($nowfile); }else{ echo "<b>Warning:</b> Now file '$nowfile' doesn't exist"; } } ?> <HTML> <HEAD> <TITLE><?php echo $page_title; ?></TITLE> <link rel="stylesheet" type="text/css" href="style.css"> </HEAD> <BODY> <!--TOP SECTION (banner)--> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR> <TD valign="top"><img src="theme/page/banner.gif"></TD> <TD valign="middle"><div align="right"><?php include('ads/ad_top.php'); ?></div></TD> </TR> </TABLE> <!--MIDDLE SECTION--> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR> <TD width=150px valign="top"><?php require('left.php'); ?></TD> <TD valign="top"> <table width=100% border=0 cellspacing=2 cellpadding=0> <TR><TD><?php include('nav.php'); ?></TD></TR> <TR><TD><?php include('body.php'); ?></TD></TR> </table> </TD> </TR> </table> <BR> <div align="center"><font size="1"> This page is under the <a href="http://gplv3.fsf.org/">GPLv3</a> by <a href="http://www.redgalaxy.net" target="_blank">Red Galaxy</a>. Each file is copyrighted by its respective owner.<BR> This page is not to be held responsible for any uploaded files. It is each user's responsibility to check the legality of files they upload.<BR> Please contact <i><?php echo $info_name; ?></i> at <?php echo str_replace('@', "'AT'", str_replace('.', "'DOT'", $info_email)); ?> with any questions.<BR> <?php echo $info_misc; ?></font> </div> </BODY> </HTML> <?php mysql_close(); ?> nav.php <?php if (!defined('PHP_DOWNLOADCENTER')) exit; ?> <table width=100% border=0 cellspacing=0 cellpadding=0> <TR> <TD> <a href="?nav=home">Home</a> | <a href="?nav=recent">Recent Files</a> </TD> <TD align="right"> <form action="?nav=search_results" method="post"><INPUT type="text" size="20" name="search"><INPUT type="submit" value="Search"></form> </TD> </table> body.php <?php if (!defined('PHP_DOWNLOADCENTER')) exit; if (!isset($_GET['nav'])){ $location = 'pages/home.php'; }else{ $location = 'pages/'.$_GET['nav'].'.php'; } if (isset($_GET['message'])){ echo '<div align="center">'; echo BeginBorder("Message", "50%"); echo stripslashes(urldecode($_GET['message'])); echo EndBorder(); echo '</div>'; } if (file_exists($location)) include($location); else include("pages/404.php"); ?> display.php <?php $fid = $_GET['file']; $results = mysql_query("SELECT * FROM files WHERE id=$fid LIMIT 1"); if (mysql_numrows($results) == 0){ echo "File not found. It may have been removed."; return; } $who = getUserNameById(mysql_result($results,0,"uid")); echo BeginBorder(mysql_result($results, 0, "title"), "90%"); ?> <TABLE width=100% border=0 cellspacing=0 cellpadding=0> <TR><TD width=50% valign="top"> <TABLE width=100% border=0 cellspacing=1 cellpadding=2> <TR bgcolor=#F0F0F0> <TD width=50%>Name:</TD> <TD><?php echo mysql_result($results, 0, "title"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>File:</TD> <TD><?php echo mysql_result($results, 0, "filename"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Size:</TD> <TD><?php echo round( mysql_result($results, 0, "filesize")/1024/1024,2).'MB'; ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Extension:</TD> <TD><?php echo mysql_result($results, 0, "filetype"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Category:</TD> <TD><?php echo mysql_result($results, 0, "category"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>User:</TD> <TD><?php echo $who; ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Date Uploaded:</TD> <TD><?php echo mysql_result($results, 0, "date"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Download Count:</TD> <TD><?php echo mysql_result($results, 0, "dcount"); ?></TD> </TR> <TR bgcolor=#F0F0F0> <TD>Downloads This Month</TD> <TD><?php echo mysql_result($results, 0, "dmonth"); ?></TD> </TR> </TABLE> </TD> <TD valign="top"> <center> <a href="<?php echo '?nav=download&file='.$fid; ?>"><img src="theme/download.png" border=0></a> <?php if (mysql_result($results, 0, 'private') == '1') echo "<br>You must be logged in to download this file.</b>"; ?> </center><BR><BR> <?php //PREVIEW IMAGE IF EXISTS $realname = mysql_result($results, 0, "filename"); $small_preview = 'images/'.$realname.'.small.jpg'; $large_preview = 'images/'.$realname.'.large.jpg'; if (file_exists($small_preview)){ echo "<div align='center'><a href='$large_preview' target='_blank'><img src='$small_preview' border='0'></a></div><BR>"; } //ADMIN CONTROLS if (isUserAdmin()){ echo '<b>Admin:</b> <a href="?nav=delete&file='.$fid.'">Delete This File</a> | <a href="?nav=edit&file='.$fid.'">Edit</a><BR>'; } ?> </TD></TR> </TABLE> <HR> <b>Description:</b><BR> <?php echo mysql_result($results, 0, "description"); ?> <?php echo EndBorder(); ?> Hi guys, I would like to ask your help on how to trim the output (title). for example the title is "php freaks rocks" it should be "php freaks..." Thanks.. Code: [Select] <?php $Url_Path = ""; $data_dir = "" ; $images_dir =$Url_Path."/images/"; $rel_dir = ""; //Database Setting //You must change these values in order to run this script //These value are not visible in the output page source $host = ""; //Server Name $user= ""; //Username $password= ""; //Password $database=""; //Photopost database name or forum database name //Display Setting (Changes to fit your page) $q_switch = "latest"; // "random" or "most_views" or "latest" $limit = 3; //number of image to show // CSS Setting (optional) $class_photopost = ""; $class_gallery = "gallery"; // ************************************************************************* // ************************************************************************* ///////////don't edit below this line if you are too afraid to kill the code////////////// // ---------------------- THESE FUNCS FROM pp-inc ----------------- function mysql_query_eval( $query, $database ) { global $Globals; $mysql_eval_error=""; $mysql_eval_result = mysql_query($query, $database) or $mysql_eval_error = mysql_error(); if ($mysql_eval_error) { if ( $Globals{'debug'} == 1 ) { $letter = "An error was encountered during execution of the query:\n\n"; $letter .= $query."\n\n"; $letter .="The query returned with an errorcode of: \n\n$mysql_eval_error\n\n"; $letter .= "If you need assistence or feel this is a 'bug'; please report it to our "; $letter .= "support forums at: http://www.techimo.com/forum/f27/index.html\n\n"; $letter .= "To turn off these emails, set \$debug=0 in your config-inc.php file."; $email = $Globals{'adminemail'}; $email_from = "From: ".$Globals{'adminemail'}; $subject="Subject: ".$Globals{'webname'}." MySQL Error Report"; $subject=trim($subject); mail( $email, $subject, $letter, $email_from ); } elseif ( $Globals{'debug'} == 2 ) { dieWell( "MySQL error reported!<p>Query: $query<p>Result: $mysql_eval_error<p>Database handle: $database" ); exit; } return FALSE; } else { return $mysql_eval_result; } } function get_ext( $filename ) { $photolen = strlen($filename); $RetVal = substr( $filename, $photolen-3, $photolen); return $RetVal; } function get_filename($filename) { // strip off the last 4 $len = strlen( $filename )-4; $RetVal = substr( $filename, 0, $len); return $RetVal; } // ---------------------- THESE FUNCS FROM pp-inc ----------------- // Connecting, selecting database $link = mysql_connect ("$host", "$user", "$password") or die ('I cannot connect to the database.'); mysql_select_db ("$database")or die("Could not select database"); // Here is the hacked up display_gallery($q_switch) $catquery=""; if ( IsSet($cat) ) { $querya="SELECT catname FROM photopost_categories WHERE id=$cat"; $catq = mysql_query_eval($querya,$link); $catr = mysql_fetch_array($catq); $catname = $catr['catname']; mysql_free_result($catq); $queryb = "SELECT id FROM photopost_categories WHERE parent='$cat' ORDER BY catorder ASC"; $boards = mysql_query_eval($queryb,$link); $cnt=0; while ( $row = mysql_fetch_array($boards, MYSQL_ASSOC)) { $catqid = $row['id']; if ( $cnt == 0 ) { $cnt=1; $catquery .= "$catqid"; } else { $catquery .= ",$catqid"; } } mysql_free_result($boards); } // Connecting, selecting database // Selecting method and Perform SQL query switch ($q_switch) { case "most_views": if ( !IsSet($cat) ) { $group_title = "Most Popular Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY views DESC LIMIT $limit"; } else { $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY views DESC LIMIT $limit"; $group_title = "Most Popular Images - $catname"; } break; case "latest": if ( !IsSet($cat) ) { $group_title = "Most Recent Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY date DESC LIMIT $limit"; break; } else { $group_title = "Most Recent Images - $catname"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY date DESC LIMIT $limit"; break; } break; default: if ( !IsSet($cat) ) { $group_title = "Random Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY RAND() DESC LIMIT $limit"; break; } else { $group_title = "Random Images - $catname"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY RAND() DESC LIMIT $limit"; break; } break; } $i = 1; $e = 2; $col_val = $column; $result = mysql_query_eval($query,$link) or die("Query failed"); print "<ul class=\"".$class_gallery."\"> "; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $photo_name = get_filename( $line['bigimage'] ); print "<li>"; $theext = get_ext( $line['bigimage'] ); $thecat = $line['cat']; $temp_user = ($line["userid"]); $filepath = "$data_dir"."$thecat/thumbs/$photo_name.$theext"; $image_stats = getimagesize( $filepath ); $width = $image_stats[0]; $height = $image_stats[1]; $rel_path = "$rel_dir"."$thecat/thumbs/$photo_name.$theext"; print "<a class=\"".$class_photopost."\" href=\"$Url_Path"."showphoto.php?photo=".$line['id']. "\" title=\"".$line["title"]."\">"; if ( file_exists( $rel_path ) ) print "<img src='$filepath' alt='$filepath' width='$width' height='$height' /></a>"; else print "<img src='".$images_dir."nothumb.gif' alt='$filepath' width='$width' height='$height' /></a>"; if ($q_switch == "most_views") { print "<br />".$line["title"]."<br />".$line["views"]." views"; print "</a>"; } else { print "<br /> <a class=\"".$class_photopost."\" href=\"$Url_Path"."showphoto.php?photo=".$line['id']. "\" title=\"".$line["title"]." ".$line["views"]." views\"> ".$line["title"]."<br />".$line["views"]." views"; print "</a></li>"; } } print " </ul> "; // Closing connection mysql_close($link); // mysql_close($db_link); ?> |