PHP - Making A Blog.help Please.
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> Similar TutorialsThis topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=357178.0 This 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); ?> 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! 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?
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... 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();?> ?> 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. Okay so you may have noticed an earlier post from myself that problem have been fixed, Some background info, The website is currently on my test server so not connected to the internet. I have only been learning PHP for the last 3-4 days so I am fairly new to most things so please keep your explanations simple, The finished code here is being designed for use on large scale websites with a lot of users around 100,000+ per 24 hour period and therefor will need to be secure. Yet I have no idea how to do that, The script once finished will also be freely distributed and contributors will be fairly credited. I have some new problems that I need help fixing, So I am creating a PHP Blog connected to my MYSQL Database, Currently there is no admin backend that's a job for later but I do have the following files. index.php - This displays all blog posts for all my categorys news.php - This displays each blog post on there own config.php - This contains my server connect code I also have the following fields in my database articleid - Unique ID number of each blog post category - The category the blog post is in title - The title of each blog post body - The body of each post author - The name of the author date - date of posting But now I need to add some comments so can anyone please help out, The comments should only appear below the article on the 'news.php' page so I was hoping someone could write me a script to post and display the comments, (No login system needed I got that covered surprisingly.) if you can also give me a .sql file to add the needed tables to my database that would be greatly appreciated, Lastly would it be possible for someone to secure the script so it is invulnerable to SQL Injection attacks and any other form of attack that someone could pull off on the site. So bring on the code, Index.php Code: [Select] <?php include("config/config.php"); $data = mysql_query("SELECT * FROM blog ORDER by date ASC") or die(mysql_error()); while($row = mysql_fetch_array($data)) { echo "<table class='main'> <tr> <td> <a href='/news.php?articleid=" . $row['articleid'] . "' class='article_title'>" . $row['title'] . "</a> <p>" . $row['introduction'] . "</p></td><tr><td ALIGN='RIGHT' class='small'> Posted by:" . $row['author'] . ", on " . $row['date'] . ",</td></tr></table>"; } ?> Comments:I have removed all the junk out and left the basic script, news.php Code: [Select] <?php include("config/config.php"); $data = mysql_query("SELECT * FROM blog WHERE articleid = {$_GET['articleid']} ORDER by date ASC") or die(mysql_error()); while($row = mysql_fetch_array($data)) { echo "<table class='main'> <tr> <td> <a href='/news.php?articleid=" . $row['articleid'] . "' class='article_title'>" . $row['title'] . "</a> <p>" . $row['introduction'] . "</p></td><tr><td ALIGN='RIGHT' class='small'> Posted by:" . $row['author'] . ", on " . $row['date'] . ",</td></tr></table>"; } ?>Comments:So here's the complex bit if someone could please add the comments below the article here, Thanks again, Blaze, (Really bad PHP Programmer) Hello, I made myself a simple blog system, but in my case "simple" becomes difficult when it comes to writing an article. Have you ever seen that movie about how facebook was created (I think it's called "Social network" or something like that)? As a newbie web developer I noticed how "Mark" was writting his blog post. I think it was an textarea, and when he was writing article, he wrote it with html tags, like <p>. So, I have now the same problem: when I'm writing article, I have to write it with all div's and p's and a's and img's and so on. I want to avoid that. Few ideas did pop to my head: use preg_replace for some elements, and set up some javascript WYSIWYG editor (but i really don't want it, and can't explain why, I just don't like it). I have a couple of css classes for images, both of them resizes images, one resizes it a lot, other not so much, both make them smaller. One class is for image to be on the left, so the text would wap that image from the right. After paragraph I must clear floats with css class. Other image class just takes full width available and if image is bigger that that available width - it resizes image. So no need to clear floats. How can I make my life easier when I'm writing article to my blog? Hi Guys (& Ladies of course) I'm having a problem trying to add post category to the H1 title, I have managed to butcher my theme so that the single post now removes the H1 from the title in the header & instead adds it to the post title. But what I'd like to do now is keep the H1 blog title on all pages including home page, but I'd like to ammend the title with the addition of the post category, as follows; currently shows "Top Rated Gadgets" on all pages. would like it to show "Top Rated (category name)" when viewing a single post. So if the category of the post was Asus Laptops it would show "Top Rated Asus Laptops" instead of the usual "Top Rated Gadgets" The closest I have got to it so far is with Code: [Select] <?php the_category(', '); ?> but this returns a hyperlink ! Is there any method I can use that will simply return the category name as plain text..? Any help would be much appreciated Thanks I am looking for a blog app or also a magazine type web app for CakePHP to learn from - any suggestions?
I am working from Cockpit CMS and I am trying to create a blog using this tutorial.
Directory structure (simplified):
+blog -index.php + views -index.php -article.php -index.php +partials -constants.php -top.phpblog/index: <?php require_once("../partials/errorlogging.php"); ?> <?php require_once("../partials/constants.php"); ?> <?php require_once("../partials/top.php"); ?> <?php $app = new Lime\App(); // bind routes $app->bind("/", function() use($app) { $posts = collection('blog')->find(["public"=>true])->sort(["created"=>1])->toArray(); return $app->render('views/index.php', ['posts' => $posts]); }); $app->bind("/article/:id", function($params) use($app) { $post = collection('blog')->findOne(["_id"=>$params['id']]); return $app->render('views/article.php', ['post' => $post]); }); $app->run(); ?> <?php require_once("../partials/bottom.php"); ?>blog/views/index.php: <?php require_once("../../partials/errorlogging.php"); ?> <?php require_once("../../partials/constants.php"); ?> <?php require_once("../../partials/top.php"); ?> <?php foreach ($posts as $post): ?> <h2><a href="<?php $this->route('/article/'.$post['_id']);?>"><?php=$post['title'];?></a></h2> <?php endforeach; ?> <?php require_once("../../partials/bottom.php"); ?>blog/views/article.php: <?php require_once("../../partials/errorlogging.php"); ?> <?php require_once("../../partials/constants.php"); ?> <?php require_once("../../partials/top.php"); ?> <h1><?php=$post['title'];?></h1> <p> <?php=$post['content'];?> </p> <?php require_once("../../partials/bottom.php"); ?>Now at the moment if I go to domain.name/blog/ I receive this error: {"type":64,"message":"require_once(): Failed opening required '..\/..\/partials\/errorlogging.php' (include_path='.:\/home\/codio\/.parts\/packages\/php5-apache2\/5.5.15\/lib\/php')","file":"\/home\/codio\/workspace\/blog\/views\/index.php","line":1}However I know for a fact that it is not a problem with the require methods because if I run this code inblog/index.php: <?php require_once("../../partials/errorlogging.php"); ?> <?php require_once("../../partials/constants.php"); ?> <?php require_once("../../partials/top.php"); ?> <?php $app = new Lime\App(); $app->bind("/", function() { return "Hello World!"; }); $app->run(); ?> <?php require_once("../../partials/bottom.php"); ?>There is absolutely no errors on the page or console, and "Hello World" is printed to the screen, so it is to do with the blog/index.php syntax but I have no idea where the problem is... Hi all Just to let you know where I am up to currently. I have created a database for articles I want to display a a blog. I have created a blog.php page and am echoing out parts of the database. I have then created some dynamic links to display the full article on another page i've named newsarticle.php. My whole site uses includes. i.e. www.maplewebdesign.co.uk/index.php?page=home etc. I've created a sum domain - blog.maplewebdesign.co.uk but I want to re-direct this to my blog page which is www.maplewebdesign.co.uk/index.php?page=blog I hope this makes sense. I would really appriciate some help. My website is www.maplewebdesign.co.uk by the way. The blog page isn't linked yet, but the link is, www.maplewebdesign.co.uk/index.php?page=blog Thanks Adi I have a self-built blog website, done with PHP and MySQL.
How to write the posts offline? How is it done? Which tools are used?
Any suggestions?
Hi everyone, I am trying to create a blog for a webiste I am creating and keep having a problem. I have created a file called edit_comments.php which will obviously edit comments left about the blog. The problem I am having is that when I preview this page it's just blank, no error messages nothing. This is my code: Code: [Select] <?php mysql_connect ('localhost', '***', '***') ; mysql_select_db ('***'); if (isset($_POST['edit'])) { $name = htmlspecialchars(strip_tags($_POST['name'])); $comment = htmlspecialchars(strip_tags($_POST['comment'])); $comment = nl2br($comment); $id = (int)$_POST['id']; if (!get_magic_quotes_gpc()) { $name = addslashes($name); $comment = addslashes($comment); } $result = mysql_query("UPDATE php_blog_comments SET name='$name', comment='$comment' WHERE id='$id' LIMIT 1") or print ("Can't update comment.<br />" . $result . "<br />" . mysql_error()); if ($result != false) { print "<p>The comment has successfully been edited!</p>"; } } if(isset($_POST['delete'])) { $id = (int)$_POST['id']; $result = mysql_query("DELETE FROM php_blog_comments WHERE id='$id' LIMIT 1") or print ("Can't delete comment.<br />" . $result . "<br />" . mysql_error()); if ($result != false) { print "<p>The comment has successfully been deleted!</p>"; } } if (isset($_GET['id']) && !empty($_GET['id']) && is_numeric($_GET['id'])) { $result = mysql_query ("SELECT * FROM php_blog_comments WHERE id='$_GET[id]'") or print ("Can't select comment.<br />" . mysql_error()); while ($row = mysql_fetch_array($result)) { $old_name = stripslashes($row['name']); $old_comment = stripslashes($row['comment']); $old_comment = str_replace('<br />', '', $old_comment); } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><input type="hidden" name="id" id="id" value="<?php echo $_GET['id']; ?>"> <strong><label for="name">Name:</label></strong> <input type="text" name="name" id="name" size="40" value="<?php echo $old_name; ?>" /></p> <p><strong><label for="comment">Comment:<label></strong><br /> <textarea cols="80" rows="20" name="comment" id="comment"><?php echo $old_comment; ?></textarea></p> <p><input type="submit" name="edit" id="edit" value="Save Changes"> <input type="submit" name="delete" id="delete" value="Delete Comment"> <input type="submit" value="Never Mind"></p> </form> <?php } else { $result = mysql_query("SELECT entry AS get_group FROM php_blog_comments GROUP BY get_group DESC LIMIT 10") or print ("Can't select comments.<br />" . $result . "<br />" . mysql_error()); while($row = mysql_fetch_array($result)) { $get_group = $row['get_group']; print "<p>"; $result2 = mysql_query("SELECT timestamp, title FROM php_blog WHERE id='$get_group'"); while($row2 = mysql_fetch_array($result2)) { $date = date("l F d Y",$row2['timestamp']); $title = stripslashes($row2['title']); print "<strong>" . $date . " - " . $title . "</strong><br />"; } $result3 = mysql_query("SELECT * FROM php_blog_comments WHERE entry='$get_group' ORDER BY timestamp DESC"); while($row3 = mysql_fetch_array($result3)) { $id = $row3['id']; $name = stripslashes($row3['name']); $comment = stripslashes($row3['comment']); $date = date("l F d Y",$row3['timestamp']); if (strlen($comment) > 75 || strstr($comment, "<br />") || strstr($comment, "\n")) { $comment = substr($comment,0,75) . "..."; $comment = str_replace("<br />", "", $comment); $comment = str_replace("\n", " ", $comment); } print "<a href=\"editcomments.php?id=" . $id . "\">" . $comment . "</a><br />Comment by " . $name . " @ " . $date; print "</p>"; } } } mysql_close(); ?> Sorry it's a bit long. If anybody could help me understand what's happening I would really appreciate it thanks!!! hi, im making a simple blgo system, and i'd like to show a list of the last ten months, so the user can click the month name, and it will open the blog page with all the posts from that month, just like we usually see in blogs. any ideas? thanks in advance |