PHP - Trying To Make Text And Images Into Clickable Links
I'm trying to make my text and images into clickable links. The images and text are in a database so its getting really tricky for me since I'm new to PHP. I've tried many different ways without success.
Here is a snippet of the code I'm working with. As you can see, I'm also working with an image re-sizer. I would really like to make those images and text clickable links(i.e. Title). Any help is appreciated! if ($res) { while ($newArray = mysqli_fetch_array($res, MYSQLI_ASSOC)) { $detail = $newArray['id']; $photo = $newArray['photo']; $id = $newArray['title']; $price = $newArray['price']; list($width) = getimagesize($photo); // set the maximum width of the image here $maxWidth = 100; if ($width > $maxWidth) echo "<p><img alt=\"Image\" width=\"$maxWidth\" src=\"$photo\" />"; echo "Title:".$id." Price:".$price."<br/"; Similar Tutorialsok i display description from database with no isue but the thing is if there are links in description even the links like http://somesite.com shows as normal text on browser. how can i make them clickable? This one im took from php Code: [Select] print "<form action='registration.php' method='post'onsubmit='return msg();'>"; print "Your message:<br>"; print "<textarea name='message' cols='40' rows='2'></textarea><br>"; print "<a onClick=\"addSmiley(':)')\"><img src='smile.gif'></a> "; print "<a onClick=\"addSmiley(':(')\"><img src='blush.gif'></a> "; print "<a onClick=\"addSmiley(';)')\"><img src='images/wink.gif'></a> "; print "<input type='submit' name='submit' value='Set Name'></form>"; print "<script language=\"Java Script\" type=\"text/javascript\">\n"; print "function addSmiley(a)\n"; print "{\n"; print "document.form.message.value += a;"; print "document.form.message.focus();\n"; print "}\n"; print "</script>\n"; print "<br><br>"; and i converted it to html Code: [Select] <html> <form action='registration.php' method='post'> Your message:<br><textarea name='message' cols='40' rows='2'></textarea><br> <a onClick=\"addSmiley(':)')\"><img src='smile.gif'></a> <a onClick=\"addSmiley(':(')\"><img src='blush.gif'></a> <a onClick=\"addSmiley(';)')\"><img src='images/wink.gif'></a> <input type='submit' name='submit' value='Set Name'></form> <script type="text/javascript">+"\n" function addSmiley(a)+"\n" { "\n" document.form.message.value + = a document.form.message.focus()+"\n" } "\n" </script> "\n" <br> <br> </html> but that html problem is im cannot integrate the javascript im means canot click the smiley button la may i know what is wrong images are uploaded to a directory and the sql database contains the filename. I added 'url' field and am trying to link the two I have used on of the posts to help me adapt some script however I'm not sure I have the syntax right. The image in DW live view looks ok and I get the link finger ok but when previewed in browser the image is not shown at all or any link. Any ideas <? echo !empty($row['pic']) ? "<a href=\"{$row['url']}\" <img src=\"js/images/{$row['pic']}\">" : ''; ?> it echos out to a table Mike Hi, I have a blog page I am working on and I am trying to make some enhancements that I need some help with. In MySQL I have a table with id, title and post. In my page display I want to enable the user to click on the title and display a post on it's own so the URL would look like www.mysite.com/blog/?id=1 or something like that. Here is the PHP function to display the post from MySQL. all on one page. function GetBlogPosts($inId=null, $inTagId =null) { if (!empty($inId)) { $query = mysql_query("SELECT * FROM blog_posts WHERE id = " . $inId . " ORDER BY id DESC LIMIT 2"); } else if (!empty($inTagId)) { $query = mysql_query("SELECT blog_posts.* FROM blog_post_tags LEFT JOIN (blog_posts) ON (blog_post_tags.postID = blog_posts.id) WHERE blog_post_tags.tagID =" . $tagID . " ORDER BY blog_posts.id DESC"); } else { $query = mysql_query("SELECT * FROM blog_posts ORDER BY id DESC"); } $postArray = array(); while ($row = mysql_fetch_assoc($query)) { $myPost = new BlogPost($row["id"], $row['title'], $row['post'], $row['postfull'], $row["author_id"], $row['date_posted']); array_push($postArray, $myPost); } return $postArray; } I want to display 3 clickable images in a single row which repeats as long as there is data in the database, so far it is displaying a single clickable image from the database. below is all the code.. <table width="362" border="0"> <?php $sql=mysql_query("select * from `publication` GROUP BY `catsue`") or die(mysql_error()); $num=mysql_num_rows($sql); while($rowfor=mysql_fetch_array($sql)) { $cat=$rowfor['catsue']; $pic=mysql_query("select * from `category` where `catsue`='$cat'") or die(mysql_error()); $picP=mysql_fetch_array($pic); $base=basename($picP['title']); ?> <tr> <td width="352" height="88"><table width="408" border="0"> <tr> <td width="113" rowspan="5"><a href="archive_detail.php?id=<?php echo $rowfor['id'];?>&category=<?php echo $rowfor['catsue'];?>"><img src="ad/pic/<?php echo $base;?>" width="100" height="100" border="0"/></a></td> <td width="94">Title</td> <td width="179" height="1"><?php echo $rowfor['catsue'];?> </td> </tr> <tr> <td> </td> <td width="179" height="3"> </td> </tr> <tr> <td> </td> <td width="179" height="8"> </td> </tr> <tr> <td> </td> <td width="179" height="17"> </td> </tr> <tr> <td> </td> <td width="179" height="36"> </td> </tr> </table></td> </tr> <?php }?> </table> I'm not sure if this is the right section, if not, please move it on proper one, i'm still newbie. However, here's my problem, i'm using jquery to replace standard check boxes with images, and here's the code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { /* see if anything is previously checked and reflect that in the view*/ $(".checklist input:checked").parent().addClass("selected"); /* handle the user selections */ $(".checklist .checkbox-select").click( function(event) { event.preventDefault(); $(this).parent().addClass("selected"); $(this).parent().find(":checkbox").attr("checked","checked"); } ); $(".checklist .checkbox-deselect").click( function(event) { event.preventDefault(); $(this).parent().removeClass("selected"); $(this).parent().find(":checkbox").removeAttr("checked"); } ); }); </script> Here's the css: <style type="text/css"> body { font: 12px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif; } form { margin: 0 0 30px 0; } legend { font-size: 17px; } fieldset { border: 1; } .checklist { list-style: none; margin: 0; padding: 0; } .checklist li { float: left; margin-right: 10px; background: url(i/checkboxbg.gif) no-repeat 0 0; width: 105px; height: 80px; position: relative; font: normal 11px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif; } .checklist li.selected { background-position: -105px 0; } .checklist li.selected .checkbox-select { display: none; } .checkbox-select { display: block; float: left; position: absolute; top: 55px; left: 10px; width: 85px; height: 23px; background: url(i/select.gif) no-repeat 0 0; text-indent: -9999px; } .checklist li input { display: none; } a.checkbox-deselect { display: none; color: white; font-weight: bold; text-decoration: none; position: absolute; top: 55px; right: 10px; } .checklist li.selected a.checkbox-deselect { display: block; } .checklist li label { display: block; text-align: center; padding: 8px; } .sendit { display: block; float: left; top: 118px; left: 10px; width: 115px; height: 34px; border: 0; cursor: pointer; background: url(i/sendit.gif) no-repeat 0 0; text-indent: -9999px; margin: 20px 0; } </style> And finally the form thing <ul class="checklist"><li><input name="jqdemo" value="value5" type="checkbox" id="choice_c"/><label for="choice_c">Some Text Here to be checked - clicked</label><a class="checkbox-select" href="#">Click</a><a class="checkbox-deselect" href="#">Cancel</a></li></ul> I would like that my text on top of checkboxes become clickable. Hello I need help with making our dropdown links stay visible when active. Site: London tshirt .com Code: [Select] <dl id="nav"> <dt class="nav"><b>London Tshirts</b></dt> <dd> <ul> <li><a href="/Unisex">Unisex</a></li> <li><a href="/Slimfit">Slimfit</a></li> <li><a href="/Kids">Kids</a></li> </ul> </dd> <dt class="nav"><b>Alternative Tshirts</b></dt> <dd> <ul class="nav"> <li><a href="/England">England</a></li> <li><a href="/Humour">Humour</a></li> <li><a href="/Popular">Popular</a></li> </ul> </dd> <dt class="nav"><b>Magnets</b></dt> <dd> <ul class="nav"> <li><a href="/magnets-ceramic">Ceramic</a></li> <li><a href="/magnets-metal">Metal</a></li> <li><a href="/magents-plastic">Plastic</a></li> </ul> </dd> <dt class="nav"><b>Keyrings</b></dt> <dd> <ul class="nav"> <li class="current"><a href="/keyrings-ceramic">Ceramic</a></li> <li class="current"><a href="/keyrings-metal">Metal</a></li> <li><a href="/keyrings-plastic">Plastic</a></li> </ul> </dd> <dt class="nav"><b>Other gifts</b></dt> <dd> <ul class="nav"> <li><a href="/Hats">Hats</a></li> <li><a href="/Models">Models</a></li> <li><a href="/Bags">Bags</a></li> </ul> </dd> </dl> Thanks P.S. I typed my question, then went to verification, but could not read the letters so requested a new image, this refreshed the page and I lost my message?? Hey I 'm new to this but i got this code the links to images in my database and display them to the user but i want the images to pop-up out of the screen like this website : http://pinterest.com/ here when the small images are clicked displaying all the comments from users under it here is the code: and thanks <?php include('models/user.php'); ob_start(); if(isset($_GET['cat'])){ $objCat = new dbConfig(); $sqlCat = $objCat->selectQuery("select * from categories WHERE cat_id = ".$_GET['cat']); $rowCat = mysql_fetch_array($sqlCat); $title = "Blabben - ".$rowCat['cat_name']; } elseif(isset($_GET['category'])){ $objCat = new dbConfig(); $sqlCat = $objCat->selectQuery("select * from categories WHERE cat_id = ".$_GET['category']); $rowCat = mysql_fetch_array($sqlCat); $title = "Blabben - ".$rowCat['cat_name']; } else { $title = "Blabben"; } ?> <?php define('INCLUDE_CHECK',1); require "timeline/functions.php"; require "timeline/connect.php"; // remove blabs older than 1 hour to prevent spam //mysql_query("DELETE FROM blabs WHERE blab_id>1 AND blab_date<SUBTIME(NOW(),'0 1:0:0')"); //fetch the timeline if(isset($_GET['top'])&&!isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); }elseif(isset($_GET['top'])&&isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.cat_id = ".$_GET['cat'].") AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); }elseif(!isset($_GET['top'])&&isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.cat_id = ".$_GET['cat'].") AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); } elseif(isset($_GET['points'])){ $q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND (follow.follower = ".$uinfo['user_id'].") AND blabs.blab!='0' ORDER BY users.points DESC LIMIT 50"); } //elseif(isset($_GET['cat'])){ //$q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND blabs.blab!='0' AND (follow.follower = ".$uinfo['user_id'].") AND blabs.cat_id = ".$_GET['cat']." ORDER BY blabs.blab_id DESC LIMIT 50"); //}elseif(isset($_GET['category'])){ //$q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND blabs.blab!='0' AND (follow.follower = ".$uinfo['user_id'].") AND blabs.cat_id = ".$_GET['category']." ORDER BY blabs.blab_id DESC LIMIT 50"); //} else{ $q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND (follow.follower = ".$uinfo['user_id'].") AND blabs.blab!='0' ORDER BY blabs.blab_id DESC LIMIT 50"); } $timeline=''; //$row1=mysql_fetch_assoc($q); //$bd = $row1['blab_date']; //$blab_date = relativeTime($bd,$precision=2); while($row=mysql_fetch_assoc($q)) { $timeline.=formatTweet($row['name'],$row['uname'],$row['state'],$row['picture'],$row['blab'],$row['blab_date'],$row['user_id'],$row['blab_id']); } // fetch the no blab $noblab = ''; //if(isset($_GET['cat'])){ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs WHERE blab!=0 AND cat_id=".$_GET['cat'])); //} //elseif(isset($_GET['category'])){ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs WHERE blab!=0 AND cat_id=".$_GET['category'])); //}else{ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs where `blab`!='0'")); //} //if($blabcount<=0){ $noblab = "<div style='padding:20px 15px; text-align:center;' id='noblab'>No Blab Posted</div>"; } ?> <script> $(document).ready(function(){ $('#noblab').hide(); }); </script> <?php if(isset($_GET['verified'])&& $_GET['verified']=='1'){ ?> <script type="text/javascript"> showNotification({ message: "Congratulations! You have got 250 points for verifying your account", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['verified'])&& $_GET['verified']=='11'){ ?> <script type="text/javascript"> showNotification({ message: "Your account is already verified.", type: "error", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['blab'])&& $_GET['blab']=='added'){ ?> <script type="text/javascript"> showNotification({ message: "Blab has been added successfully.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if((isset($_GET['welcome'])&& $_GET['welcome']=='1')||($uinfo['verified']=='0')){ ?> <script type="text/javascript"> showNotification({ message: "<span style='color:#000;'><strong>Confirm your email address to access all of Blabben's features</strong>. A confirmation message was sent to <strong><?php echo $uinfo['email']; ?></strong><br /><span style='color:#000;'><a style='color:blue; text-decoration:underline; font-weight:normal;' href='models/resend.php'>Resend Confirmation Email</a> | <a style='color:blue; text-decoration:underline; font-weight:normal;' href='account'>Update Email Address</a></span></span>", type: "success", autoClose: false, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['blab'])&& $_GET['blab']=='deleted'){ ?> <script type="text/javascript"> showNotification({ message: "Blab has been deleted successfully.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['b'])&& $_GET['b']=='err'){ ?> <script type="text/javascript"> showNotification({ message: "Sorry! You don't have enough points.", type: "error", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['resent'])&& $_GET['resent']=='1'){ ?> <script type="text/javascript"> showNotification({ message: "Confirmation email has been resent on your Email.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <SCRIPT LANGUAGE="JavaScript"> <!-- Limit the number of characters per textarea --> <!-- Begin function textCounter(field,cntfield,maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else cntfield.value = maxlimit - field.value.length; } // End --> </script> <!--tabs--> <div id="tabs-con"> <div id="tabs1"> <!--id="nation"--> <div class="tab roundT"><a href="http://www.blabben.com">Blabbing</a><!--<span></span>--> </div> <div class="tab roundT"><a href="upload-picture.php">Upload Picture</a></div> <div class="tab roundT"><a <?php if(isset($_GET['cat'])){ ?>href="home?category=<?php echo $_GET['cat']; ?>" <?php } elseif(isset($_GET['category'])){ ?>href="home?category=<?php echo $_GET['category']; ?>"<?php }elseif(isset($_GET['tp'])){ ?>href="home?alltp"<?php }else{ ?>href="home?all"<?php } ?>> <?php if(isset($_GET['cat'])){ ?><?php echo $rowCat['cat_name']; ?> All Pictures<?php } elseif(isset($_GET['category'])){ ?><strong><?php echo $rowCat['cat_name']; ?> All Pictures</strong><?php } elseif(isset($_GET['alltp'])){ ?><strong>All Recent Pictures</strong><?php } elseif(isset($_GET['all'])){ ?><strong>All Recent Pictures</strong><?php }else{ ?>All Recent Pictures<?php } ?></a></div> <div class="tab roundT"><a <?php if(isset($_GET['cat'])){ ?> href="home?tp&cat=<?php echo $_GET['cat']; ?>" <?php }else{ ?>href="home?tp"<?php } ?>> <?php if(isset($_GET['cat'])){ ?><?php echo $rowCat['cat_name']; ?> Top Pictures<?php } elseif(isset($_GET['tp'])||isset($_GET['alltp'])){ ?><strong>Top Pictures</strong><?php } else{ ?>Blabben Top Pictures<?php } ?></a></div> </div> </div> <!--tabs end--> <!-- <div class="blabnation"> <ul class="user-dropdown"> <li <?php //if(!isset($_GET['nation'])){?>id="selected"<?php //}else{}?>><a href="home">Blab Friends</a></li> <li <?php //if(isset($_GET['nation'])){?>id="selected"<?php //}else{}?>><a href="home?nation">Blab Nation</a></li> </ul> </div> --> <!--content--> <div id="content" class="round1"> <?php if(!isset($_GET['top'])){ $objBP = new dbConfig(); $objBP1 = new dbConfig(); //echo $_GET['cat']; if(isset($_GET['cat'])&&!isset($_GET['tp'])){ $cate = "select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND follow.follower = ".$uinfo['user_id']." AND blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.blab='0' AND blabs.cat_id = ".$_GET['cat']." ORDER BY blab_id DESC LIMIT 8"; $sqlBP = $objBP->selectQuery($cate); } elseif(isset($_GET['category'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND blabs.cat_id = categories.cat_id AND follow.follower = ".$uinfo['user_id']." AND blabs.user_id = users.user_id AND blabs.blab='0' AND blabs.cat_id = ".$_GET['category']." ORDER BY blab_id DESC LIMIT 8"); } elseif(isset($_GET['all'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND blabs.cat_id = categories.cat_id AND follow.follower = ".$uinfo['user_id']." AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY blab_id DESC LIMIT 75"); } elseif(isset($_GET['tp'])&&!isset($_GET['cat'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories WHERE blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY blabs.blab_id DESC LIMIT 75"); //$sqlBP = $objBP->selectQuery("select * from likes,blabs,users,categories WHERE likes.blab_id = blabs.blab_id AND blabs.cat_id = categories.cat_id AND likes.show='1' AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY likes.liked DESC LIMIT 75"); } elseif(isset($_GET['tp'])&&isset($_GET['cat'])){ $t = "select * from blabs,users,categories WHERE blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.cat_id = ".$_GET['cat']." AND blabs.blab='0' ORDER BY blabs.blab_id DESC LIMIT 75"; $sqlBP = $objBP->selectQuery($t); } elseif(isset($_GET['alltp'])){ $sqlBP = $objBP->selectQuery("select * from likes,blabs,users,categories,follow WHERE follow.following = blabs.user_id AND (likes.blab_id = blabs.blab_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.cat_id = categories.cat_id) AND (likes.show='1') AND (blabs.user_id = users.user_id) AND (blabs.blab='0') ORDER BY likes.liked DESC"); } elseif(!isset($_GET['tp'])&&isset($_GET['cat'])) { $sqlBP = $objBP->selectQuery("select * from blabs,users,follow,categories WHERE (blabs.cat_id = categories.cat_id) AND (follow.following = blabs.user_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.user_id = users.user_id) AND (blabs.blab='0') AND (blabs.cat_id = ".$_GET['cat'].") ORDER BY blab_id DESC LIMIT 8"); } else { $sqlBP = $objBP->selectQuery("select * from blabs,users,follow,categories WHERE (blabs.cat_id = categories.cat_id) AND (follow.following = blabs.user_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.user_id = users.user_id) AND (blabs.blab='0') ORDER BY blab_id DESC LIMIT 8"); } ?> <script> function deleteblab(blab){ c = confirm("Are you sure you want to delete this?"); if(c==true){location.href = "models/picblab_mdl.php?bid="+blab+"&delete=blab"} } </script> <!--blab--> <div id="blabs-con"> <ul> <?php $c=1; while($rowblab = mysql_fetch_array($sqlBP)){ ?> <?php //count likes $objLike = new dbConfig(); $sqlLike = $objLike->selectQuery("select * from likes WHERE blab_id = ".$rowblab['blab_id']); $countLike = mysql_num_rows($sqlLike); //find if person liked $objLike1 = new dbConfig(); $sqlLike1 = $objLike1->selectQuery("select * from likes WHERE blab_id = ".$rowblab['blab_id']." AND user_id = ".$uinfo['user_id']); $countLike1 = mysql_num_rows($sqlLike1); //get comments $objBs = new dbConfig(); $sqlBs = $objBs->selectQuery("select * from comment WHERE blab_id = ".$rowblab['blab_id']); $countBs = mysql_num_rows($sqlBs); //get repics $objRe = new dbConfig(); $sqlRe = $objRe->selectQuery("select * from blabs WHERE reblab = ".$rowblab['blab_id']); $countRe = mysql_num_rows($sqlRe); ?> <li class="box"> <div class="blabs" fancybox> <!--fancybox srart--> <!-- Add mousewheel plugin (this is optional) --> <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/jquery.mousewheel-3.0.6.pack.js"></script> <!-- Add fancyBox main JS and CSS files --> <script type="text/javascript" src="js/fancybox/jquery.fancybox.js"></script> <link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox.css" media="screen" /> <!--fancybox end--> <script type="text/javascript"> $(document).ready(function() { $(".fancybox").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'fade', 'width' : 615, 'height' : 'auto', 'type' : 'img' }); }); </script> <script> $(document).ready(function(){ //$('#commentwr<?php //echo $c; ?>').hide(); $('#commentbt<?php echo $c; ?>').click(function(){ //$('#commentwr<?php //echo $c; ?>').slideToggle('slow'); $('#comment<?php echo $c; ?>').focus(); }); }); </script> <?php if($_SESSION['UserInfo'][0]==$rowblab['user_id']) {?> <div class="delete1"><a href="javascript:;" onclick="deleteblab('<?php echo $rowblab['blab_id']; ?>')"><img src="images/delete.png" title="Delete this Picture" alt="Delete" /></a></div> <?php } ?> <div class="blabs-img fancybox"><!--blabs-img start--> <?php if($rowblab['blab_img']==NULL){ ?> <a class="fancybox" href="article.php?blab=<?php echo $rowblab['blab_id']; ?>"><img src="images/avatar.png" width="198" /></a> <?php } else { ?> <a class="fancybox" href="article.php?blab=<?php echo $rowblab['blab_id']; ?>"><img src="pictures/large/<?php echo $rowblab['blab_img']; ?>" width="198" /></a> <?php } ?> <div class="blab-text"><?php echo $rowblab['blab_caption']; ?></div> <div class="blab-text1"><?php echo $countLike; ?> likes</div> <div class="blab-text1"><?php echo $countBs; ?> blabs</div> <div class="blab-text1"><?php echo $countRe; ?> repics</div> </div><!-- blabs-img end--> <div class="like fancybox" ><img id="commentbt<?php echo $c; ?>" style="cursor:pointer;" src="images/Blab.jpg" width="61" height="18" /> <?php if($countLike1<=0){ ?> <a class="fancybox" href="models/likes_mdl.php?action=like&bid=<?php echo $rowblab['blab_id']; ?>&uid=<?php echo $rowblab['user_id']; ?>&page=home"><img src="images/Like.jpg" width="56" height="18" /></a> <?php }?> <?php if($rowblab['user_id']!=$uinfo['user_id']){ ?> <form style="float:right;" name="repic" id="repic" action="models/repic_mdl.php?action=repic" method="post"> <input name="uid" type="hidden" value="<?php echo $rowblab['user_id']; ?>" /> <input name="blab_img" type="hidden" value="<?php echo $rowblab['blab_img']; ?>" /> <input name="blab_id" type="hidden" value="<?php echo $rowblab['blab_id']; ?>" /> <input name="blab_caption" type="hidden" value="<?php echo $rowblab['blab_caption']; ?>" /> <input name="cat_id" type="hidden" value="<?php echo $rowblab['cat_id']; ?>" /> <input type="image" src="images/RePic.png" /> </form> <?php }?> </div> <div class="onto"> <?php if($rowblab['picture']==NULL) { ?> <span><img src="images/avatar.png" width="30" /></span> <?php } else { ?><img src="users_images/small/<?php echo $rowblab['picture']; ?>" width="30" /><?php } ?> <span><strong><a href="./<?php echo $rowblab['uname']; ?>"><?php echo $rowblab['name']; ?></a> @<?php echo $rowblab['uname']; ?></strong> onto <strong><a href="home?cat=<?php echo $rowblab['cat_id']; if(isset($_GET['tp'])){echo "&tp";} ?>"><?php echo $rowblab['cat_name']; ?></a></strong></span></div> <?php $objCom = new dbConfig(); //$coms = "select * from blabs,users,comment WHERE blabs.user_id = comment.user_id AND blabs.blab_id = comment.blab_id AND comment.blab_id = ".$rowblab['blab_id']." ORDER BY comment.com_id DESC LIMIT 2"; $sqlCom = $objCom->selectQuery("select * from comment WHERE blab_id = ".$rowblab['blab_id']." ORDER BY com_id DESC LIMIT 2"); $comCount = mysql_num_rows($sqlCom); if($comCount>=1){ while($comments = mysql_fetch_array($sqlCom)){ ?> <div class="onto1"> <?php $objComU = new dbConfig(); $sqlComU = $objComU->selectQuery("select * from users WHERE user_id = ".$comments['user_id']); $comU = mysql_fetch_array($sqlComU); if($comU['picture']==NULL) { ?> <span><img src="images/avatar.png" width="30" /></span> <?php } else { ?><img src="users_images/small/<?php echo $comU['picture']; ?>" width="30" /><?php } ?> <span><strong><a href="./<?php echo $comU['uname']; ?>"><?php echo $comU['name']; ?></a></strong> <?php echo $comments['comment']; ?></span></div> <?php }} if($countBs>=2){ ?> <div class="onto1" style="text-align:center"> <span><strong><a href="article.php?blab=<?php echo $rowblab['blab_id']; ?>">All <?php echo $countBs; ?> comments...</a></strong></span></div> <?php } ?> <div id="commentwr<?php echo $c; ?>" class="onto1 comments" style="text-align:center"> <span><strong><form action="models/comment_mdl.php?put=blab&uid=<?php echo $rowblab['user_id']; ?>" method="post" name="comment"><input name="blab_id" type="hidden" value="<?php echo $rowblab['blab_id']; ?>" /><textarea name="comment" id="comment<?php echo $c; ?>" placeholder="Blab It Up" maxlength="140" style="max-width:186px; min-width:186px; width:186px; height:24px;max-height:50px;" cols="" rows=""></textarea></strong></span><br /> <input name="" type="image" src="images/Blab.jpg" style="margin-top:6px;" /></form> </div> </div> </li> <?php $c++; } ?> </ul> <?php } ?> </div> <!--blabs end--> <?php if(!isset($_GET['all'])&&!isset($_GET['category'])&&!isset($_GET['alltp'])&&!isset($_GET['tp'])) {?> <!--content 2--> <div id="content2" style="margin-bottom:20px;"> <a id="timeline"></a> <!--content left--> <div id="left"> <!--tabs--> <div id="tabs-inside"> <div class="tab-inside roundT"><a href="home"><?php if(!isset($_GET['top'])&&!isset($_GET['points'])){ ?><strong>Blabbing</strong><?php } else {?>Blabbing<?php } ?></a></div> <div class="tab-inside roundT"> <?php if(isset($_GET['cat'])){ ?><a href="home?top&cat=<?php echo $_GET['cat']; ?>"><?php if(isset($_GET['top'])) {?><strong><?php echo $rowCat['cat_name']; ?> Top Blabs</strong><?php }else { ?><?php echo $rowCat['cat_name']; ?> Top Blabs</a><?php }}else {?><a href="home?top"><?php if(isset($_GET['top'])) {?><strong>Blabben Top Blabs</strong><?php }else { ?>Blabben Top Blabs</a><?php }} ?></div> <!--<div class="tab-inside roundT"><a href="home?points"><?php //if(isset($_GET['points'])){ ?><strong>Points</strong><?php //} else {?>Points<?php //} ?></a></div>--> </div> <!--tabs end--> <div id="leftcon"> <div style="text-align: center;"><?php echo $noblab; ?></div> <ul class="statuses"><?=$timeline?></ul> </div> </div> <!--conetne left end--> <!--content right--> <div id="right"> <!--tabs--> <div id="tabs"> <div class="tab1 roundT">My Blab Profile<span class="catname1"><?php if(isset($_GET['cat'])){ echo $rowCat['cat_name']; } elseif(isset($_GET['category'])){ echo $rowCat['cat_name']; } ?></span></div> </div> <!--tabs end--> <!--profile--> <div id="blab-profile"> <div id="profile"> <?php if($uinfo['picture']==NULL) { ?> <img src="images/avatar.png" width="50" /> <?php } else { ?><img src="users_images/large/<?php echo $uinfo['picture']; ?>" width="50" /><?php } ?><span> </span><?php echo $uinfo['name']; ?><br /> <a href="<?php echo $uinfo['uname']; ?>">View Profile page</a></div> <!--counts--> <div id="counts"> <div id="count-blabs1"> <?php $objBlab = new dbConfig(); $sqlBlab = $objBlab->selectQuery("select * from blabs WHERE user_id = ".$_SESSION['UserInfo'][0]); $countBlab = mysql_num_rows($sqlBlab); $objF = new dbConfig(); $sqlF = $objF->selectQuery("select * from follow WHERE follower = ".$_SESSION['UserInfo'][0]); $following = mysql_num_rows($sqlF); $objF1 = new dbConfig(); $sqlF1 = $objF1->selectQuery("select * from follow WHERE following = ".$_SESSION['UserInfo'][0]); $follower = mysql_num_rows($sqlF1); $objPoints = new dbConfig(); $sqlPoints = $objBlab->selectQuery("select * from users WHERE user_id = ".$_SESSION['UserInfo'][0]); $countPoints = mysql_fetch_array($sqlPoints); ?> <span><?php echo $countBlab; ?></span><br /> <a href="profile">BLABS</a></div> <div id="count-points1"><span><?php echo $countPoints['points']; ?></span><br /> <a href="profile">POINTS</a></div> </div> <!--counts end--> <!--counts--> <div id="counts"> <div id="count-follow1"><span><?php echo $following; ?></span><br /> <a href="profile?following">FOLLOWING</a></div> <div id="count-follower1"><span><?php echo $follower; ?></span><br /> <a href="profile?followers">FOLLOWERS</a></div> </div> <!--counts end--> <?php $objbid = new dbConfig(); $qb = "select * from blabs order by blab_id desc limit 1"; $sqlbid = $objbid->selectQuery($qb); $bid= mysql_fetch_array($sqlbid); $b_id = $bid['blab_id']+1; ?> <div id="blabit-up"> <form id="blabfrm" name="blabfrm" method="post"> <textarea name="blab" id="blab" placeholder="Blab It Up" class="validate[required] text-input" tabindex="1" rows="2" cols="40" onKeyDown="textCounter(document.blabfrm.blab,document.blabfrm.counterb,160)" onKeyUp="textCounter(document.blabfrm.blab,document.document.blabfrm.counterb,160)"><?php if(isset($_GET['cat'])){?>wrote onto <?php echo $rowCat['cat_name'].": "; ?><?php }elseif(isset($_GET['category'])) { ?>wrote onto <?php echo $rowCat['cat_name'].": "; }?></textarea> <input name="name" type="hidden" value="<?php echo $_SESSION['UserInfo'][1]; ?>" /> <input name="state" type="hidden" value="<?php echo $_SESSION['UserInfo'][6]; ?>" /> <input name="city" type="hidden" value="<?php echo $_SESSION['UserInfo'][5]; ?>" /> <input name="picture" type="hidden" value="<?php echo $_SESSION['UserInfo'][10]; ?>" /> <input name="uname" type="hidden" value="<?php echo $_SESSION['UserInfo'][4]; ?>" /> <input name="cat_id" type="hidden" value="<?php if(isset($_GET['cat'])) { echo $_GET['cat']; } elseif(isset($_GET['category'])) { echo $_GET['category']; } else { echo "35"; }?>" /> <input name="blab_id" type="hidden" value="<?php echo $b_id; ?>" /> <span class="catname"><?php if(isset($_GET['cat'])){ echo "<span style='text-transform: capitalize;'>".$rowCat['cat_name']."</span>"; }elseif(isset($_GET['category'])){ echo "<span style='text-transform: capitalize;'>".$rowCat['cat_name']."</span>"; } ?></span> <input name="counterb" class="counter" style="border:none; background:none;margin: 0; width: 50px;" disabled="disabled" value="160" type="text" /> <!--<span style="min-width:100px" class="counter">160</span>--> <input class="submitButton inact" name="submit" type="submit" value=" " disabled="disabled" /> <div class="clear"></div> </form> </div> </div> <!--blab of day--> <div id="tabs"> <div class="tab1 roundT" style="margin-top:10px;">Blab of the day</div> </div> <?php $objday = new dbConfig(); $sqlday = $objday->selectQuery("select * from trending WHERE trending_active = '1' ORDER BY trending_id DESC"); $bofdayn = mysql_num_rows($sqlday); if($bofdayn<=0){ ?> <div class="recent-comments" style="background: none repeat scroll 0 0 #FFFFFF; margin-left: 6px; width: 93%;"> <div class="pinned"><strong>No Blab</strong></div> </div> <?php } else { while($bofday = mysql_fetch_array($sqlday)){ ?> <div class="recent-comments" style="background: none repeat scroll 0 0 #FFFFFF; margin-left: 6px; width: 93%;"> <!-- onclick="document.getElementById('q').value='<?php //echo $bofday['trendings']; ?>'"--> <div class="pinned" style="padding-left:13px;"><a href="search?q=<?php echo $bofday['trendings']; ?>" id="bofday"><?php echo $bofday['trendings']; ?></a></div> </div> <?php }} ?> <!--blab of day end--> </div> <!--profile end--> </div> <!--conetne right end--> </div> <!--content 2 end--> <?php } ?> </div> <!--content end--> </div> <!--wrapper end--> <script src="js/masonry/jquery.masonry.min.js"></script> <script> $(function(){ var $container = $('#blabs-con'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector : '.box', columnWidth : 0 }); }); }); </script> </body> </html> <?php $content = ob_get_contents(); ob_end_clean(); require_once("mainTemplate.php"); ?> Say I have a chunk of code that looks like this (contains imagesx): Code: [Select] <span style="color: #0000BB">$width </span><span style="color: #007700">= </span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">); <br /> within the code I would like to make all the php functions link to php.net I thought that the following code would work, but it does not, well because there is no spaces around the above word public function phpLinks($string){ $words = explode(" ", $string); $str = array(); foreach($words as $word){ if(function_exists($word)){ $str[] = preg_replace("/$word/i", '<a href="//php.net/'.strtolower($word).'">'.$word.'</a>', $word); }else{ $str[] = $word; } } return implode(" ", $str); } I now can not think of a good way to do this, so I am asking does anyone have any suggestions? The Issue (note: sorry for double post in the regex forum.) My users can post comments. I want to turn the hidden links within those comments into clickable URLs. I have the following function to do this: Code: [Select] if (!function_exists('create_link')) { function create_link($url) { $pattern = "#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#ie"; $link_title = character_limiter(preg_replace($pattern, "$3", $url), 50); $link = preg_replace($pattern, "'<a href=\"$1\" target=\"_blank\">{LINK_TITLE}</a>$4'", $url); if ($link == $url) { $url = 'http://' . $url; $link = preg_replace($pattern, "'<a href=\"$1\" target=\"_blank\">{LINK_TITLE}</a>$4'", $url); } if ($link != $url) { $result = str_replace('{LINK_TITLE}', $link_title, $link); } else { $result = FALSE; } return $result; } } I know that the regex is pretty bad. It kind of works, but makes every single thing with a period into a link, and messes up sometimes with target= portion where it will actually display that. I've tried a bunch of other regex's but every single one gives me problems, typically like "php unknown modifier ]" or ")" or something. here's how I call this function when users hit submit in the comment field: Code: [Select] $words = preg_split("/[\s,]+/", $comment); foreach ($words as $word) { if ($link = create_link($word)) { $comment = str_replace($word, $link, $comment); I just want to convert the right links into links. is something like: ^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$ any better? I don't know, nothing seems to work. hello. i have a navigation which i downloaded from Code: [Select] http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm and i would link to pull the information in from my db this is the html Code: [Select] <div class="arrowlistmenu"> <h3 class="menuheader expandable">title</h3> <ul class="categoryitems"> <li><a href="#">link</a></li> </ul> <h3 class="menuheader expandable">title</h3> <ul class="categoryitems"> <li><a href="#">link</a></li> <li><a href="#" class="subexpandable">nested title</a> <ul class="subcategoryitems" style="margin-left: 15px"> <li><a href="#">title</a></li> </ul> </li> <li><a href="#">title</a></li> </ul> <div> </div> in the database each link and title have there own parent id and level id so for example: $level $parent_id $title $link $url For april fools, I want to have all text reversed, as if the person is looking through a mirror. I know I could probably go through every line strrev'ing it, but that terribly inefficient since we have over 30 files. Is there some code I can have to do this automatically? like put something as an include and it automatically does this? Thanks! how can make the text box like line as in the photo
When i upload photos and the name of the photo i would like to be able to overlay a portion of the original photo with another image already in the site directory, and also add the photos name over the top of the overlayed image, i may have explained this in a confusing way so i have attached an example. Is this something that can be done using something like GD or imagick, if so could someone please give me a good place to start. Hi All, i am trying to Generate a image dynamically. Up to here i am able to do it . But when i give any echo statement with this its not working.. Here is my code pls help me in this <?php // Create a 55x30 image $im = imagecreatetruecolor(79, 79); $unknow = imagecolorallocate($im, 0, 255, 255); $white = imagecolorallocate($im, 255, 255, 255); // Draw a white rectangle imagefilledrectangle($im, 4, 4, 75, 25, $unknow); imagefilledrectangle($im, 4, 29, 75, 50, $unknow); imagefilledrectangle($im, 4, 54, 75, 75, $unknow); // Save the image echo 'hi hello'; header("Content-type: image/png"); //imagepng($im, './imagefilledrectangle.png'); imagepng($im); imagedestroy($im); ?> Thanks in advance. hi, how is everybody doing? i hope well, i have a problem with some php code. i am trying to split some text in two parts once they have been split, they are display, but sometimes the php code break the source code of the page such as images and instead of the image i get the source code like this Quote add-plugins-paintnet-1.2-800x800 3857cff9733e6a.jpg" style="border-width: 1px; border-color: #000000; border-style: solid; margin: 4px auto 5px; display: block;" /> i have tried for about 2 days now to fix it and i haven't been able to, so any help or guidence would be greatly appreciated. this is the code that i am currently using, i have tried to change the variable in the $findTag but nothing seems to work Code: [Select] <? php $article =$this->article_>text; $countchars=strlen($article); $divide=$countchars/2; $firstpart=substr($article,0,$divide); $secondpart=substr($article,$divide); //i keep changing the <p /> variable to <img /> and $image and many others but nothing seems to work $findTag = strpos($secondpart, "<p /> "); $var = $divide + $findTag $firstpart = substr($article, 0, $var); $secondpart = substr($article, $var); ?> thanks Ok, first off CSS is definitely not my strong suit so bear with me here. This is my code:
<style media="screen" type="text/css"> /* <!-- */ .clear{ clear:both; } #grid{ width: 100%; } .grid-element{ width:33%; float:left; } a.clickable-div { display: block; height: 100%; width: 100%; text-decoration: none; } .img { height:auto; width:inherit; max-height:100%; max-width:100%; } .button { color: #900; font-weight: bold; font-size: 150%; text-transform: uppercase; display: block; width: 50%; } /* --> */ </style> <div id="grid"><div class="grid-element" align="center"> <img src="images/light_offline.png" class="img"> <p><h1>Hue Lamp 1 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=2&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 2 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=3&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 3 </h1></div></div><p> <div align="center"> <form method="POST" action="action.php"> <input type="hidden" name="scene" value="02b12e930-off-0"> <input type="submit" value="Scene 1" class="button"> </form> <p><form method="POST" action="action.php"> <input type="hidden" name="off"> <input type="submit" value="All Off" class="button"> </form> </div>This is the browser output. A couple things are wrong: 1. Why aren't the images scaling so they are all the same size? I assigned the same CSS class to each of the images but they are all appearing differently. The original images are all the same size. 2. Why are my buttons in the far right corner? I want to have them centered below the images so as to prevent the horizontal scroll bar, which I hate. Attached Files output.png 232.09KB 0 downloads I apologize in advance, I know pretty much nothing about PHP - don't hate me, please! But I'm working on a form mailer, and it functions, but what I don't like is it leaves all the text fields, blank or not, in my email, which makes it difficult for my client to read, so theres a long list of txt field1: another text field: blah blah: all the way down the email - and I want it gone! haha. I've researched how to do this, but basically, I have no idea how to implement it into my code and don't have time right now to up and learn PHP. My code is as follows: Code: [Select] <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'PCI Tour/Excursion Request'; // Your email address. This is where the form information will be sent. $emailadd = 'MY EMAIL HERE'; // Where to redirect after form is processed. $url = 'FORWARDING URL'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> IT was a very simple copy-paste form, but I have no idea what on earth I'm doing. If anyone has any ideas I would GREATLY appriciate the help! Thanks! -Austin the idea on what im doing is like a converter, like showing what your name would look like with certain images per letter, when you input text (your name for example) and when you press the submit button you would get a series of images in a row that represent each character that you typed.
here is the example that i did...
<html> <?php Hello. After much searching I dont seem to be able to find anyone who has had this issue. I am writing a bounce handler. To get the bounced email of the original recipient I need to download the TEXT part of the bounced message. The original message contained INLINE Images. Many of the bounced messages are returned what appears to be the INLINE image embedded as text in the TEXT part of the email. This means I am having to download TEXT parts which are many MB in size when all i need is about the first 1Kb to get the email address and status code. Does anyone know if there is an IMAP parameter/command that I can tell it to only download the first NNN BYTES of the TEXT Part. I have seen this done using FOPEN to read messages. |