PHP - Blog Search
Hi all,
I am trying to implement a search of a blog, using Object Oriented PHP, a concept which seems a little alien to me. I have had an attempt at it but it doesn't seem to work, but am not really sure why. I think that i have told the search on post to refer to the command BlogSearch and then within that command look for the titles of the blogs that are the same as the search and display them. Any help greatly appreciated. <?php /*views/index.php*/ require_once("ViewHelper.php"); ViewHelper::DisplayHeader("Blog index");?> <h1>Blog index</h1> <p>You can <a href="index.php?cmd=BlogAddForm">add messages</a> !</p> <form action="index.php?cmd=BlogSearch" method="post"> Search: <input name="search"> <input type="submit" value="Search!"> </form> <? foreach($data as $message) echo("<div class=\"message\"> <h2>{$message['title']}</h2> <p>{$message['message']}</p> <a href=\"index.php?cmd=BlogDelete&id={$message['id']}\">Delete this message</a> </div>"); ?> <?ViewHelper::DisplayFooter();?> <?php require_once("ViewHelper.php"); ViewHelper::DisplayHeader("Blog index");?> <? foreach($title as $search) echo("<div class=\"message\"> <h2>{$message['title']}</h2> <p>{$message['message']}</p> </div>"); ?> <?ViewHelper::DisplayFooter();?> ?> Similar TutorialsThis topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=323879.0 hey, i need some help if possible. I basicly have 2 tables, one has the blog posts and one has the blog comments. I'm trying to display the latest 5 blog posts (which works) but underneath each of the blog posts i need to display about 3 of the latest comments for that post but it isn't showing any. any ideas? here's my code: Code: [Select] <? session_start(); $myusername = $_SESSION['myusername']; $db_host = 'localhost'; $db_user = 'HIDDEN'; $db_pwd = 'HIDDEN'; $database = 'tjwebsol_dev'; $table = 'posts'; $table2 = 'blog_comments'; $tab = '&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {$table} ORDER BY blog_id DESC LIMIT 5"); if (!$result) { die("Query to show fields from table failed"); } $sql = mysql_query("SELECT * FROM {$table2} ORDER BY comment_id ASC LIMIT 5 "); $fields_num = mysql_num_fields($result); $fields_num2 = mysql_num_fields($sql); while($row2 = mysql_fetch_assoc($sql)) { $blog_comments = $row2['comment_content']; $date_commented = $row2['date_commented']; $time_commented = $row2['time_commented']; $blog_username2 = $row2['username']; $blogid = $row2['blogid']; $comment_id = $row2['comment_id']; } while($row = mysql_fetch_assoc($result)) { $blog_title = $row['title']; $blog_content = $row['content']; $blog_username = $row['username']; $blog_date = $row['date_posted']; $blog_time = $row['time_posted']; $blog_id = $row['blog_id']; echo "<hr>"; echo "<div class='post'>"; echo "<h2 class='title'><a href='#'>$blog_title</h2></a>"; echo "<p class='byline'>posted by <b>$blog_username</b> on <b>$blog_date</b> ($blog_time)</p>"; echo "<br>"; echo "<div class='entry'>$blog_content</div><br>"; if ($blogid == $blog_id) { echo "<b>User Posted Comments:</b><br><br>"; echo "$tab<b>$comment_id</b>. $blog_comments"; echo "<br><br>"; echo "Commented posted by <b>$blog_username2</b> on <b>$date_commented ($time_commented)</b>"; echo "<br><br><br>"; } if (!isset($_SESSION['logged']) || $_SESSION['logged'] !== true) { // not logged in, move to login page echo "<b><a href='login.php'>Login</a></b> to post your comments!"; } echo "<br><br><br>"; include('blognewcomment.php'); echo ""; echo "</div>"; } mysql_free_result($result); ?> The result pages is supposed to have pagination like google help me please
I require a page to be added to my website. This page will facilitate a refined search via Google, Bing and Yahoo search engine simultaneously , show the top 5 of each engine. Is this possible using php ? Thank's Hello, Does anyone know a tutorial I can follow to create my own search engine over the items I have in my SQL database? I find a lot of tutorials but they are all 'one word searches' which means if you type two words you will get all results that contain either word (too many hits). If the search engine tutorial displays result with AJAX even better. Thanks for help. df I have code to search a database of members, I can search by lastname but having a little problem. I want to be able to search by lastname starting with the first letter. (ie: a or b or c or d and so on). As it is right now I can only search by first letter of last name if I add % to the search (ie: a% b% c%) will give me all members with the last names starting with the approiate letter designation. I'm not sure how to handle this, any help would be appreciated. Thanks. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <center><table cellspacing="10" cellpadding="10" width="750" border="0"> <h4>Search</h4> <form name="search" method="post" action="<?php $PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="lname">Last Name</option> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <?php // check to see if anything is posted if (isset($_POST['find'])) {$find = $_POST['find'];} if (isset($_POST['searching'])) {$searching = $_POST['searching'];} if (isset($_POST['field'])) {$field = $_POST['field'];} //This is only displayed if they have submitted the form if (isset($searching) && $searching=="yes") { echo "<h4>Results</h4><p>"; // If they did not enter a search term we give them an error if (empty($find)) { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "root", "1910") or die(mysql_error()); mysql_select_db("cmc_member") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); // Now we search for our search term, in the field the user specified $results = mysql_query("SELECT * FROM members WHERE upper($field) LIKE'$find'"); // And we display the results if($results && mysql_num_rows($results) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($results)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product ALIGN='CENTER' if($fname != "" && $fname != null) echo "<td ALIGN='CENTER'><FONT COLOR='red'><b>$fname $lname</b></FONT><br> $address <br> $city $state $zip <br>$phone<br><a href=\"mailto: $email\">$email</a><br></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches = mysql_num_rows($results); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> </tr> </table></center> </body> </html> Friends, I want to extract the Search Keyword from the URL, a visitor came from. I am using a PHP CMS and want to show the Keyword on my Blog. So if they search "abcd" from google, i want to extract "abcd" and echo on my blog. Here is the coding i could got hold of, but its not working, not echoing anything <?php function pk_stt2_function_get_delimiter($ref) { $search_engines = array('google.com' => 'q', 'go.google.com' => 'q', 'images.google.com' => 'q', 'video.google.com' => 'q', 'news.google.com' => 'q', 'blogsearch.google.com' => 'q', 'maps.google.com' => 'q', 'local.google.com' => 'q', 'search.yahoo.com' => 'p', 'search.msn.com' => 'q', 'bing.com' => 'q', 'msxml.excite.com' => 'qkw', 'search.lycos.com' => 'query', 'alltheweb.com' => 'q', 'search.aol.com' => 'query', 'search.iwon.com' => 'searchfor', 'ask.com' => 'q', 'ask.co.uk' => 'ask', 'search.cometsystems.com' => 'qry', 'hotbot.com' => 'query', 'overture.com' => 'Keywords', 'metacrawler.com' => 'qkw', 'search.netscape.com' => 'query', 'looksmart.com' => 'key', 'dpxml.webcrawler.com' => 'qkw', 'search.earthlink.net' => 'q', 'search.viewpoint.com' => 'k', 'mamma.com' => 'query'); $delim = false; if (isset($search_engines[$ref])) { $delim = $search_engines[$ref]; } else { if (strpos('ref:'.$ref,'google')) $delim = "q"; elseif (strpos('ref:'.$ref,'search.atomz.')) $delim = "sp-q"; elseif (strpos('ref:'.$ref,'search.msn.')) $delim = "q"; elseif (strpos('ref:'.$ref,'search.yahoo.')) $delim = "p"; elseif (preg_match('/home\.bellsouth\.net\/s\/s\.dll/i', $ref)) $delim = "bellsouth"; } return $delim; } /** * retrieve the search terms from search engine query * */ function pk_stt2_function_get_terms($d) { $terms = null; $query_array = array(); $query_terms = null; $query = explode($d.'=', $_SERVER['HTTP_REFERER']); $query = explode('&', $query[1]); $query = urldecode($query[0]); $query = str_replace("'", '', $query); $query = str_replace('"', '', $query); $query_array = preg_split('/[\s,\+\.]+/',$query); $query_terms = implode(' ', $query_array); $terms = htmlspecialchars(urldecode(trim($query_terms))); return $terms; } /** * get the referer * */ function pk_stt2_function_get_referer() { if (!isset($_SERVER['HTTP_REFERER']) || ($_SERVER['HTTP_REFERER'] == '')) return false; $referer_info = parse_url($_SERVER['HTTP_REFERER']); $referer = $referer_info['host']; if(substr($referer, 0, 4) == 'www.') $referer = substr($referer, 4); return $referer; } $referer = pk_stt2_function_get_referer(); if (!$referer) return false; $delimiter = pk_stt2_function_get_delimiter($referer); if( $delimiter ){ $term = pk_stt2_function_get_terms($delimiter); } echo $term; ?> May someone help? Natasha T Hello, I'm developing a website that asks the user to submit a keyword for a search. The results should display matches for this keyword, but also show matches for related keywords (in order of relevenace!). I'm planning on building up a library of which search terms users use in the same sessions (e.g. if someone searches for "it jobs" and "php jobs", I'll know the terms are correlated), and I'll also measure the click-through rates of the items on the results list. I've been spending all weekend trying to map out the design for this but it's proving incredibly complicated and I think the solution is likely to be on the internet somewhere already?! Please could someone point me in the right direction if you've come accross this problem before? Thanks a million, Stu Hi all How do I modify the below code to search multiple tables in mySQL database? $query = "select * from store_items where description like \"%$trimmed%\" or title like \"%$trimmed%\" or dimensions like \"%$trimmed%\" order by id ASC"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); It is for a search function and I need it to search another table called 'about_text' and 'faq_text' Thanks Pete Hello. I am working on a php script for searching a database table. I am really new to this, so I used the this tutorial http://www.phpfreaks.com/tutorial/simple-sql-search I managed to get all the things working the way I wanted, except one important and crucial thing. Let me explain. My table consist of three columns, like this: ID(bigint20) title(text) link (varchar255) ============================= ID1 title1 link-1 ID2 title2 link-2 etc... Like I said, I managed to make the script display results for a search query based on the title. Want I want it to do more, but I can't seem to find the right resource to learn how, is to place a "Download" button under each search result with its corresponding link from the table. Here is the code I used. <?php $dbHost = 'localhost'; // localhost will be used in most cases // set these to your mysql database username and password. $dbUser = 'user'; $dbPass = 'pass'; $dbDatabase = 'db'; // the database you put the table into. $con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); // Set up our error check and result check array $error = array(); $results = array(); // First check if a form was submitted. // Since this is a search we will use $_GET if (isset($_GET['search'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); // remove any html/javascript. if (strlen($searchTerms) < 3) { $error[] = "Search terms must be longer than 3 characters."; }else { $searchTermDB = mysql_real_escape_string($searchTerms); // prevent sql injection. } // If there are no errors, lets get the search going. if (count($error) < 1) { $searchSQL = "SELECT title, link FROM db WHERE title LIKE '%{$searchTermDB}%'"; $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}"); if (mysql_num_rows($searchResult) < 1) { $error[] = "The search term provided {$searchTerms} yielded no results."; }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$row['title']}<br /> Download - this is the button I want to link to the title results - and maybe other links too - <br /> "; $i++; } } } } function removeEmpty($var) { return (!empty($var)); } ?> <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" . implode("<br />", $error) . "</span><br /><br />":""; ?> <form method="GET" action="search?" name="searchForm"> Search for title: <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" /> <input type="submit" name="submit" value="Search" /> </form> <?php echo (count($results) > 0)?"Rezultate lucrari de licenta sau disertatie pentru {$searchTerms} :<br /><br />" . implode("", $results):""; ?> $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$row['title']}<br /> Download - this is the button I want to link to the title results - and maybe other links too - <br /> "; $i++; I would like the results to be displayed like this Results for SearchItem: Result 1 Download | Other link Result 2 Download | Other link etc.... or something like this. So, how do I add the data from the link row into a text(Dowload), within an <a href> tag (well, at least I guess it would go this way) ? My first tries (fueled by my lack of knowledge) where things like $results[] = "{$row['title']}<br /> <a href="{$row['link']}">Download</a> <br /> "; but I keep getting lots of errors, and then I don't know much about arrays and stuff (except basic notions); So there it is. I am really stuck and can't seem to find any workaround for this. Any suggestions? (examples, documentation, anything would do, really) Thanks, Radu I am developing a intranet forum in Php and MySQL and I am using ajax to display searched results on the same page but right now I am using query LIKE text% to search in database which is slower. but I want to make it fast search engin which can parse *,+ and show result. Since I am using ajax i am not able to use free search engin,so if possible pls provide a complete solution Hello All, I have looked around. And what I came across was not necessarily what I was looking for.
I was wondering if somebody can recommend a good tutorial for building a blog in PHP OOP?
Also, I was wondering if somebody perhaps knows a good blog app written in PHP OOP, where I could be learning from the script files?
Hey I have this blog http://www.nikita-andrews.com/ingrid/?page_id=34 ... Im trying to remove the prettyphoto enlargement on posts to this page ... and not sure how to go about it. The code for thumbnail.php is Code: [Select] <?php if (has_post_thumbnail()) { $data = get_post_meta( $post->ID, 'key', true ); if ($data[ 'project_link' ]) { ?> <a class="externalLink tooltip" title="View Live Site" target="_blank" href="<?php echo $data[ 'project_link' ]; ?>">∞</a> <?php } ?> <?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); if ($data[ 'video_link' ]) { ?> <a class="thumbLink video" rel="prettyPhoto" href="<?php echo $data[ 'video_link' ]; ?>"> <?php } else { echo '<a class="thumbLink" href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >'; } the_post_thumbnail(); echo '</a>'; } ?> I want the thumbnails to still show but just not enlarge. Infact itd be even better if they just linked directly to the post itself. Any help would be much appreciated! So I started a blog project just to help me out with learning php. This is my post form <form action="insert.php" method="post"> Title: <input type="text" name="title"> <br> Post: <input type="text" name="post"> <br> Author: <input type="text" name="author"> <br> <input type="submit"> </form> Insert.php <?php $con = mysqli_connect("localhost","test","","test"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $title = mysqli_real_escape_string($con, $_POST['title']); $content = mysqli_real_escape_string($con, $_POST['post']); $author = mysqli_real_escape_string($con, $_POST['author']); $sql="INSERT INTO article (title, content, author) VALUES ('$title', '$content', '$author')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); ?> But when I try to display that information he <h1>Title: </h1> <?php echo $title; ?> <h2>Content: </h1> <?php echo $content; ?> <h3>Posted by: </h1> <?php echo $author; ?>It doesn't work and I get this: ( ! ) Notice: Undefined variable: title in C:\wamp\www\test\index.php on line 33 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0 Content: ( ! ) Notice: Undefined variable: content in C:\wamp\www\test\index.php on line 34 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0 Posted by: ( ! ) Notice: Undefined variable: author in C:\wamp\www\test\index.php on line 35 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0The form works because when I looked at the database, the information was there. The problem is getting that information and displaying it in the right place, how can i fix that? Just in case, this is my index: <?php include ('connect.php'); include ('header.php'); ?> <div id="container"> <div id="rightcol"> <form action="insert.php" method="post"> Title: <input type="text" name="title"> <br> Post: <input type="text" name="post"> <br> Author: <input type="text" name="author"> <br> <input type="submit"> </form> </div> <div id="content"> <h1>Title: </h1> <?php echo $title; ?> <h2>Content: </h1> <?php echo $content; ?> <h3>Posted by: </h1> <?php echo $author; ?> </div> </div> <?php include "footer.php"; ?> </div> Hi guys, Am having trouble with my OO php blog. i can add, delete and search for messages but cannot update them as i get the folowing eror message (see below) Quote Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM messages WHERE id = NULL' at line 1' Have checked that when i hover over the link i do get an id number and it is pointing to the correct cmd i.e. blogAmend. Any ideas as to where i am going wrong, files attatched for further info. Hello Im trying to figure out how to use flat textfiles to my blogproject but cant get the grip on it. It has to be filebased. I can't find any descent tutorial on the web either and it starts really getting on my nerves... 1. How do i save new blogposts in a textfile so they can be easily read? Should i use only one file with append and write all blogposts to it one after another? or save a new textfile for each new blogpost/entry? If so, how do i name them so they don't write over each other accidentally. I need to save (date+writer+title+blogpost). 2. How do i read the files so i can sort them by date/time , latest entry up/oldest entry down? they should appear on my blog startside in the middle one after another. Should i read each blogpost into an array so i can sort them or what? If so how do i do that? 3. I need a list of links connected to each blogpost so when you click link the correct blogpost is shown in the middle of the page same side as the links. the links should be sorted so all posts from oktober is shown under "oktober" and so on... I have ripped half my hair off by now so any general advice how i should do would be appreciated... I am building a blog server with dreamweaver and phpMyAdmin so I have an wpindex.php page showing the topics and a topic page, wptopic.php showing only that topic. I need to create a link from the wpindex.php to wptopic.php. The link is: Code: [Select] wptopic.php?ID=<?php echo $row_Recordset1['ID']; ?> *Recordset1 is a query of the blog post table* However, when I tested it, all post's link are 'wptopic.php?ID=1'. How can I fix it? Also, in the wptopic.php page, there is a place to show comments. However, when there is no comment, there is still a 'says' word in the page. how can I make the 'says:' disappear when there is no comments? The Code: Code: [Select] <p>Comment:</p> <p align="right"><?php echo $row_Recordset2['comment_author']; ?>says:</p> <p align="right"><?php echo $row_Recordset2['comment_content']; ?>*Recordset2 is a query of the blog reply table* Thks! hello, i have been trying to find scripts or write a custom php script so i can have a feedback/comment type blog on my website. im trying to go for the same type of design layout and function as the blog on this site: http://www.jessicaswift.com/treasuring/ I have found a few scripts but they are on sites that want me to pay for the scripts and coding, but im not sure if its legit or even what im looking for cause they dont have full demos of them. if anyone could help me out by pointing me in the right direction with a website or tutorial for what im trying to do. Im not sure if javascript would be better for what im trying to do. cause i dont want to have a full out blog like from wordpress or blogger.com my site im building for my sister is www.jessicadurrant.com if you go to the blog page you will see its a wordpress blog, which i dont want to use. i would like to set up something like the blog that is on the first website link i posted about. Again any help would be greatly appreciated. Hi am in the middle of making a blog but am having problems with one page am working on if anyone can help me please. What is am looking for is to post username and avatar instead of just the username. I have already paid some guy to work on this but he didnt get back to me and ihave no more cash to give for the code to be finished so i would really appreciate if someone could help to finish this off please thanks. this is the where the username and text shows which i would like avatar to show as well. Code: [Select] <?php $query = yasDB_select("SELECT * FROM user WHERE username = '$user'"); $row = $avatarfile; $query = yasDB_select("SELECT * FROM topic WHERE userid = '$id' ORDER BY id DESC LIMIT 5"); if($query->num_rows == 0) { ?> <div id="memberstext">This topic has no comments, be the first to add one!</div> <?php } else { while($row = $query->fetch_array(MYSQLI_ASSOC)) { $text = $row['comment']; $text = str_replace(':D','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />',$text); $text = str_replace(':?','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/confused.gif" title="confused" alt="confused" />',$text); $text = str_replace('8)','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cool.gif" title="cool" alt="cool" />',$text); $text = str_replace(':cry:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cry.gif" title="cry" alt="cry" />',$text); $text = str_replace(':shock:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/eek.gif" title="eek" alt="eek" />',$text); $text = str_replace(':evil:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/evil.gif" title="evil" alt="evil" />',$text); $text = str_replace(':lol:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/lol.gif" title="lol" alt="lol" />',$text); $text = str_replace(':x','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/mad.gif" title="mad" alt="mad" />',$text); $text = str_replace(':P','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/stlyes/images/smileys/razz.gif" title="razz" alt="razz" />',$text); $text = str_replace(':oops:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/redface.gif" title="redface" alt="redface" />',$text); $text = str_replace(':roll:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />',$text); $text = str_replace(':(','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/sad.gif" title="sad" alt="sad" />',$text); $text = str_replace(':)','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/smile.gif" title="smile" alt="smile" />',$text); $text = str_replace(':o','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/surprised.gif" title="surprised" alt="surprised" />',$text); $text = str_replace(':twisted:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/twisted.gif" title="twisted" alt="twisted" />',$text); $text = str_replace(':wink:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/wink.gif" title="wink" alt="wink" />',$text); if ( $row['useavatar'] == '1' ) { $avatarimage = $siteurl . 'avatars/' . $row['avatarfile']; } else { $avatarimage = $siteurl . 'avatars/useruploads/noavatar.gif'; } ?> <div id="box"> <div class="name"><img src="<?php echo $avatarimage;?>" height="40" width="40" align="left"><br /><?php echo $row['name'];?></div> <div class="comment_text"><?php echo $text;?></div></div> This is the form part of it to add the text Code: [Select] <div id="box2"> <form name="addcomment" method="post" action=""> <strong>Message:</strong><br /> <textarea name="comment" rows="3" cols="40" id="comment_message"></textarea><br /> <input name="userid" type="hidden" value="<?php echo $id;?>" /> <input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" /> </center> <!-- start of smiles --> <div id="smiles"><center> <a href="javascript:addsmilie(' :D ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/biggrin.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :? ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/confused.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' 8) ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/cool.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :cry: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/cry.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :shock: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/eek.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :evil: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/evil.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :lol: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/lol.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :x ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/mad.gif';?>" border="0" /></a><br /> <a href="javascript:addsmilie(' :P ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/razz.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :oops: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/redface.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :roll: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/rolleyes.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :( ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/sad.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :) ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/smile.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :o ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/surprised.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :twisted: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/twisted.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :wink: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/wink.gif';?>" border="0" /></a> </center></div> <input name="name" type="hidden" value="<?php echo $_SESSION['user'];?>" /><br /> <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" /> </form></div> |