josh22x Posted August 4, 2008 Share Posted August 4, 2008 Ok, I am working on setting up a php blogging engine. I have got the individual posts set up so that only about 150 words are shown initially. How do I configuring the posts so that the title in a link to the full post? I know I could do this by making each individual title unique and then assigning a sql statement that says something like select...where title = 'whatever';. But how do I do this with php so that each title of each submitted post has a link that will automatically display the full post? how do I do this with php so that each title of each submitted post has a link that will automatically display the full post? (like the ones on the home page of PHP Freaks) I assume this would be possible with php and mysql, but would javaScript be necessary? Thanks in advance! -- If you could give me a short example of code to demonstrate a solution that would be great! Link to comment https://forums.phpfreaks.com/topic/118133-turning-php-blog-title-into-a-link/ Share on other sites More sharing options...
Stephen Posted August 4, 2008 Share Posted August 4, 2008 Not sure what you mean. You mean like: "Well this is my new blogging system. It will automatically cut off wo... [READ MORE]" If you mean like that you can use substr on the front page and then just make a page something like: <?php //readme.php $_readid=$_GET["id"]; $_return=mysql_query("SELECT * FROM table WHERE id = '".$_readid."' LIMIT 1"); $_rows=mysql_fetch_array($_return); echo(nl2br($_rows["content"])); ?> "Well this is my new blogging system. It will automatically cut off wo... <a href='readme.php?id=1'>[READ MORE]</a>" Keep in mind there is no security on that, so you will want to add some. EDIT: This forum turns < /a> into [ /url] =\ Link to comment https://forums.phpfreaks.com/topic/118133-turning-php-blog-title-into-a-link/#findComment-607779 Share on other sites More sharing options...
josh22x Posted August 4, 2008 Author Share Posted August 4, 2008 Yes, that is exactly what i am trying to accomplish. I understand what you are saying, except how would I assign the id? I am assuming that would just be a temporary id assigned to each post, but that would not be something pulled from the database correct? Could you elaborate on how I would assign one of these ids to each post and then have it assigned to the Read More link? Thanks! Link to comment https://forums.phpfreaks.com/topic/118133-turning-php-blog-title-into-a-link/#findComment-607817 Share on other sites More sharing options...
josh22x Posted August 4, 2008 Author Share Posted August 4, 2008 Sorry, I just say you connect to the database for that... Basically, I do not know how to tell the link (when I click on it) what post to select? - via an id or whatever. Would I use the $_GET for this purpose. If so, how? Right now I am using get and it is returning nothing? Thanks again! Link to comment https://forums.phpfreaks.com/topic/118133-turning-php-blog-title-into-a-link/#findComment-607874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.