TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   need help tweeking a sweetcron site (http://www.talkphp.com/absolute-beginners/4679-need-help-tweeking-sweetcron-site.html)

yoav 07-03-2009 02:33 PM

need help tweeking a sweetcron site
 
hi,

i installed sweetcron on my site to function as my blog and what im trying to do is make it that my front page always shows the most recent blog post above the activity feed. so far no luck...

i was wondering if anyone can help me out..

thanks,

yoav

adamdecaf 07-03-2009 05:56 PM

I don't see an API, if they have one it would be the answer to this question.

*EDIT*

Alright This should get you started.
PHP Code:

<?php
// Set the detauls
    
$hostname "db1932.perfora.net";
    
$dbname "db291144085";
    
$username "dbo291144085";
    
$password "qNwx9kTX";
    
// Now grab the lastest item
$connect mysql_connect($hostname$username$password);
    
mysql_select_db($dbname);
    
    
// build the query.
    
$sql "SELECT * FROM items ORDER BY id DESC LIMIT 1";
    
$query mysql_query($sql);
    
    
// Now make it an array
    
$query mysql_fetch_array($queryMYSQL_ASSOC);
    
        
// A Little Debugging
        // print_r($query);
        
    // Now we can take the query and treat it like an array
        
echo "Title: <a href='" $query["item_permalink"] . "'>" $query[item_title] . "</a><br />";
        echo 
"Content: " $query["item_content"] . "<br />";
        echo 
"Time: " $query["item_date"] . "<br />";

?>

A sample response is:
Code:

Array
(
    [ID] => 1
    [item_date] => 1246652528
    [item_content] => Whats up?
    [item_title] => Hello World
    [item_permalink] =>
    [item_status] => publish
    [item_name] => hello-world
    [item_parent] => 0
    [item_data] => a:0:{}
    [item_feed_id] => 0
)

Example: http://open.ashannon.us/junk/sweetcr...-sweetcron.php

*Notes*
I have to give the guy who created this a LOT of credit, he has tons of features. I think that he lost interest or didn't have and visible support so he stopped this project, but it's a great system. I would recommend it if you like the demo.

adamdecaf 07-05-2009 08:06 PM

Is that guy there, or did I get "scammed" out of helping him? agh...

Enfernikus 07-05-2009 08:08 PM

Adamn it's much faster to wrap your array elements in quotes

yoav 07-05-2009 10:14 PM

I'm defiantly here!

the only thing is that i live in israel so with the time differences it sometimes takes me a few hours to reply...

thanks for your solution ill run it on my site and post the results asap!

your the man!

yoav

adamdecaf 07-05-2009 11:28 PM

Quote:

Originally Posted by yoav (Post 26657)
I'm defiantly here!

the only thing is that i live in israel so with the time differences it sometimes takes me a few hours to reply...

thanks for your solution ill run it on my site and post the results asap!

your the man!

yoav

Ah, no problem.

Quote:

Originally Posted by Enfernikus (Post 26654)
Adamn it's much faster to wrap your array elements in quotes

Hmm, they were quoted on my version. Weird, I will update it.


All times are GMT. The time now is 08:53 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0