Recent Topics

1 Jun 01, 2008 17:31    

My b2evolution Version: Not Entered

Is it possible to pull the last post from one category only and display it remotely on my sites root home page ? my site is all PHP and I'm assuming you should be able to do this ? If i knew what i was doing im assuming i could write bit of code to pull the data straight from the MYSQL database ?

any help would be awesome !

2 Jun 01, 2008 17:40

It'd really help if we knew what evo version you run, but, you want to be looking at the evo_post_cats table for the post ID's, and the evo_items__item table for the last post ID.

An alternative is to use the core to restrict $MainList to a single category and 1 post limit. You'd gain the benefits of fully a fully rendered post but have the overhead of loading the whole core to display a single post.

*If* the post is already rendered ( done by viewing it after posting/editing) then you can pull the rendered version from evo_items__pre_rendered ( or summat )

¥

4 Jun 01, 2008 17:47

If you just want a mysql solution ( no "load the evo core" overheads ) then play with the tables.

If you don't mind the overheads then take a look at /summary.php || /a_stub.php ( will need amending to do the whole "just this category", "just one post", but very doable )

¥

5 Jun 01, 2008 17:52

ok thanks ! :D I will try figure it out :)

6 Jun 03, 2008 14:48

Well I've had a look around the internet for PHP tutorials and I've got this far lol.

<?php
$user="username";
$host="localhost";
$password="password";
$database = "opmedias_opmsblog";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
?>
<?php
echo "tester";
?>
<?php

?>

I have the right password and username, I removed them for obvious reasons.

what I'm having problems with is selecting the right table out of the DB and saying;

if category != news (dont post)

else (post only the last entry)

If there is anyone who has already done this, or knows PHP very well and can whip this up real quick I'd love to know :D

7 Jun 03, 2008 17:30

It really would be far easier to use the evo core, have a play with a_stub.php or summary.php

¥

8 Jun 03, 2008 17:33

oh ok, i got the impression that would require rendering the whole core into my page ?? but i only want one post formatted by myself, but i will try that, thanks :)

9 Jun 03, 2008 17:46

Ok that was helpfull !!

I got to this point;

http://www.opmediasolutions.com.au/a_stub.php

now i just need to figure out how to only get the post so i can include it into my main website home page. does this only require a skin ?

I'm going to have a look at summary.php now to see what that can do.

10 Jun 03, 2008 17:55

Ok, in the same stub file you can make "$skin='summat_that_only_has_the_post_bits_with_no_sidebar_and_other_crap';"

Then just code that skin to have bugger all else except the post content ;)

¥

11 Jun 03, 2008 18:03

thnx !! ill work on making a skin :)
you've been very helpful, much appreciated :)

12 Jun 03, 2008 18:28

Hmmm this is odd, i found the "basic" skin and installed it, thinking it would be easy to edit, via the skin manager, but when i point the a_stub to it with the $skin paramater it still displays the default skin ? yet from the skin settings page in the dashboard i can correctly preview the skin. is there a reason for this ?

edit: i think it may be to do with the fact im restricting it to a specific category. when i try to add the &cat=2 to the url that already has tempskin=basic it reverts to not having a tempskin

edit: edit: well i figured out thats right, it will only display in the default skin if you force a category, you can still however limit the amount of posts, so it might pay to make a second blog thats private and pull posts from there ?

13 Jun 03, 2008 18:50

The second blog would .... *should* .... work, but specifying a category in a_stub.php shouldn't change stuff .... mind you, you also shouldn't need "tempskin=foo" in your url ( you shouldn't need tempskin at all )

¥

14 Jun 03, 2008 18:54

¥åßßå wrote:

The second blog would .... *should* .... work, but specifying a category in a_stub.php shouldn't change stuff .... mind you, you also shouldn't need "tempskin=foo" in your url ( you shouldn't need tempskin at all )

¥

I didnt need a temp skin, it was the only way i could view the skin at the time as it wouldnt allow me to use a skin when i specified a category.

i used the temp skin in the URL to test if it was a problem with the a_stub.php not opening the skin or a problem with the skin not being accessible.

As soon as i took out the '$cat = "2";' it let me use other skins.

so from what i did it appears specifying a category inhibits your skin choice.

15 Jun 03, 2008 18:59

I have got it working to an extent, i just need to attach a CSS file now, integrate into my home page, and i should be good to go !, thank you VERY MUCH for your help :) you've been great :D

http://www.opmediasolutions.com.au/a_stub.php

will post it up when it's all finished as I havent really seen anything like this elsewhere.

16 Jun 03, 2008 19:01

I keep telling people that deep down ..................... real deep .................... deeper .................... I'm a genius :D

¥


Form is loading...