Old 12-07-2005   #1 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
can this be done?

I'm redoing one of my websites as the layout bores me to death! But anyway I have a blog in www.crazymofo.info/blog i use wordpress for it is their a way by php that I can show half of the first post that changes when I post another and stuff

(sorry to be a pain but I just thought it would be a good idea and I hope you get what I mean as well)
__________________
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-07-2005   #2 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
Quote:
that I can show half of the first post that changes when I post another
no no,i spent 5 minutes reading and still cannot get it,pls explain it again,sorry for my terrible E.skill ><

And for the ideas,you arer doing with string,check it here,the hero of every PHP coder
[ http://www.php.net/manual/en/ref.strings.php ]
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-07-2005   #3 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
Quote:
Originally Posted by ParaSnake
no no,i spent 5 minutes reading and still cannot get it,pls explain it again,sorry for my terrible E.skill ><

And for the ideas,you arer doing with string,check it here,the hero of every PHP coder
[ http://www.php.net/manual/en/ref.strings.php ]

well on wordpress you write something and press submit and it shows on the page well I just wanted to show like the top one

is that any better haha
__________________
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-07-2005   #4 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
Quote:
Originally Posted by supafly
is their a way by php that I can show half of the first post
PHP Code:
<?php

$str 
"your news article here...";

$length strlen($str);

$cut_string substr$str0round($length 2) );

# $cut_string is half of $str

?>
reference:
strlen() - gets length of a string
substr() - returns part of a string according to start and length arguments
round() - rounds to the nth degree if given, otherwise the nearest whole number
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-07-2005   #5 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
hmm but how do i show the first artical on a diffrent page like my main index

hehe if i'm asking to much please tell me lol
__________________
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-08-2005   #6 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
PHP Code:
<?php

$query 
mysql_query("SELECT * FROM NewsTable LIMIT 1");

?>
?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-08-2005   #7 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
I`ve downloaded WordPress to see what you meant from the beginning of this thread lolz
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-08-2005   #8 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
hmm i dunno i'll give it a try Scrowler thanks for the help guys!
__________________
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-08-2005   #9 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
Well,i`ve installed and running WordPress on my localhost,and here may this help you :
In my opinion,you want to display your newest entry of the blog to anywhere you want?so...
PHP Code:
//first,connect to mySQL using info stored in wp-config.php
$a mysql_query("SELECT * FROM wp_posts WHERE ID = MAX(ID)") or die(mysql_error());
$b mysql_fetch_assoc($b); 
if the above query wont work,pls play around with "SELECT MAX(ID) FROM wp_posts".I`m going to sleep rite now,sorry if this doesnt help you
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-08-2005   #10 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
oooooh i'll give it a go thanks for the help you guys love you hehe

[edit] when using that ParaSnake i get Invalid use of group function and since I don't know anything really about php and mysql I don't know how to fix it
__________________

Last edited by supafly; 12-08-2005 at 11:09 PM.
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-13-2005   #11 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
ehhh,sorry to let you wait for 4 days,i was too busy at school that i forget this lolz
Here what i`ve tested,it works very well...
PHP Code:
//Connect to database
mysql_connect("localhost","username","password")or die(mysql_error());
mysql_select_db("wordpress");

//The currently max ID in ur database means your newest post
$a mysql_query("SELECT MAX(ID) FROM wp_posts") or die(mysql_error());
$b mysql_fetch_assoc($a);
$maxID $b['MAX(ID)'];

$a mysql_query("SELECT * FROM wp_posts WHERE ID ='".$maxID."' ") or die(mysql_error());
$b mysql_fetch_assoc($a);

$date    $b['post_date'];
$content $b['post_content'];
$title   $b['post_title']; 
What you have to do is to echo the date,content and title anywhere you want,and it will output the nweest entry in ur blog.Hope it matched ur idea
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-14-2005   #12 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
or shorter yet, to select the latest entry only:

PHP Code:
<?php

mysql_connect
("localhost","username","password")or die(mysql_error());
mysql_select_db("wordpress"); 

$a mysql_query("SELECT * FROM wp_posts ORDER BY ID DESC LIMIT 1");
$b mysql_fetch_assoc($a);

$date    $b['post_date'];
$content $b['post_content'];
$title   $b['post_title'];

?>
thus cutting down the need to run 2 seperate queries
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-15-2005   #13 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
hey thats kool bro
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-15-2005   #14 (permalink)
Face addict
 
supafly's Avatar
 
Join Date: May 2004
Location: Preston England on the west side
Posts: 290

Send a message via MSN to supafly
thank you one and all it's now working and online w00ty
__________________
supafly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-29-2005   #15 (permalink)
Registered User
 
Join Date: Dec 2005
Posts: 5

sorry for semi-offtopic post, but I use grey matter and, Couldnt you just type part of the entry in the regular and then finish it in the extended entry box? then again, I dont know if word press supports this
pipersdragon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 06:57 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT