Recent Topics

1 Jan 27, 2009 04:00    

My b2evolution Version: 2.x

I am trying to follow the instructions for making stickies but it's not working. Version 2.4.5. This is where I got the instructions from:

http://forums.b2evolution.net/viewtopic.php?t=17036

I created the sticky element in post types ok. I inserted the code line in index.php but it doesn't seem to make a difference. Here is the code

$orderby = 'ptyp_ID datemodified';

In the instrucations it says the line $orderby is to be altered but does not say how it is to be altered.

I tried changing ptyp_ID to 5001 but no good

I tried changind date modified to datecreated still no good

If anyone can tell me how to do this I think I'd be in business.

Thanks
river

2 Jan 29, 2009 05:28

Hello.

I'm just adding this feature as we speak, therefore this is my interpretation thus far...

In thread t=17036,

PHP:

// Stickies go first
$orderby = 'ptyp_ID datemodified'; 

// That's it, now let b2evolution do the rest! :)
require $inc_path.'_blog_main.inc.php';

?>

The line $orderby is the one that is altered.

I take it you've added this line as you said, in /blogs_subdir/index.php unless you're not using a subdir for b2evo. You'd add it in this file IFF you're calling this file for the default blog.

That thread also says (I'm paraphrasing), if you're using stub files, for sticky posts, you must add the $orderby statement in each one that you're using. NOTE: If you are using stub files AND the default blog feature, you'd need to add it to both files for that one blog.

Here's the actual info from that thread regarding this:

Note 2: If you are using stub files (and you will know if you do) you will need to alter the appropriate stub file and not index.php

The $orderby var first shows the field this feature pertains to in the database table "items__item" which would be "post_ptyp_ID." The 2nd param in $orderby is how that field will be sorted. That is why your revision of

changing ptyp_ID to 5001

wouldn't work.

From t=17036,

Note: I used datemodified as second sort order argument. You may want datecreated there.

would refer to your

In the instrucations it says the line $orderby is to be altered but does not say how it is to be altered.

It would be a personal preference for whether you want to sort sticky posts based on 'datemodified' as shown in $orderby, or you could change it to 'datecreated' or even 'datestarted' I believe. (see t=17032 re: using 'datestarted')

HTH.

3 Jan 29, 2009 17:23

Hello,

Thanks for responding.

No, I am not using stubs. But what I need to know is how ato call the variable $orderby. In the instructions this variable is declared but not called to do anything or connected to the stic ky field.

4 Jan 29, 2009 21:24

Hello again.

I'm not sure what the answer is to your question as I was able to get the stub files and index.php file revised according to the instructions and they work fine. I even added the color to the sticky posts as instructed also with minor skin adaptation changes.

Once the variable was put into each of the files as instructed, it get called automatically by the script.

Wish I could have been more help to you.

5 Jan 29, 2009 22:39

Wow

Are you saying you entered it exactly as the instructions said

$orderby = 'ptyp_ID datemodified';

without any alterations and it worked just like that? Or did you have to make some changes? As I said I am not using stub files.[/quote]

6 Jan 29, 2009 22:46

Yes river.

I have b2evo in a subdir called 'blogs' so in 'blogs/index.php', I now have the following at the bottom of the file:

# Additionnaly, you can set other values (see URL params in the manual)...
# $order = 'ASC'; // This for example would display the blog in chronological order...


// Stickies go first
$orderby = 'ptyp_ID datecreated'; 


// That's it, now let b2evolution do the rest! :)
require $inc_path.'_blog_main.inc.php';
?>


This would be in each of the pertinent files calling your blogs e.g. stub files or other.

HTH.

7 Jan 30, 2009 01:58

Thanks I will try it again and see how it goes.


Form is loading...