Recent Topics

1 Nov 05, 2006 19:16    

hello,

i would like to format the blog entries according to the status they have, say, i have a status of "unread" it should be yellow, when status "done" it gets crossed out etc. how can i accomplish this?

in a similar matter, is there a way to actually show the status in the blog like categories, date etc.?

PAT

2 Nov 05, 2006 19:59

who decides their status?

3 Nov 05, 2006 20:20

in ../admin.php?ctrl=itemstatuses i can define entry statuses which are set whenever en entry is created. according to this status i want to change the format of the entry.

regards,

PAT

4 Nov 05, 2006 20:31

i would imagine you would want something like this;

if you are using the Custom skin, then look for the line;

<div class="bPost bPost<?php $Item->status( 'raw' ) ?>" lang="<?php $Item->lang() ?>">

and replace with

<div class="bPost bPost<?php $Item->status( 'raw' );
$Item_extra_status = $Item->get('t_extra_status');
if ( !$Item_extra_status )
 $Item_extra_status = 'none';
echo ' Item_extra_status_'.$Item_extra_status;
?>" lang="<?php $Item->lang() ?>">

then in it's .css file add something like

.Item_extra_status_unread {
color:yellow;
}

5 Nov 05, 2006 20:54

great, works perfectly!

a last question, what would be the code to actually show the status (and the priority btw..) in the blog entry?

PAT

6 Nov 05, 2006 20:57

ok, for status I found out myself:

<?php echo 'Status:'.$Item_extra_status;?>

what is it for priority?

PAT

7 Nov 05, 2006 21:10

echo $Item->priority;
or
$Item->priority();

8 Nov 05, 2006 21:32

ok, i tried to apply an aditional formating according to the priority of the posting. something strange happens:

when i use this code:


<div class="bPost bPost<?php $Item->status( 'raw' ); 
$Item_extra_status = $Item->get('t_extra_status'); 
if ( !$Item_extra_status ) 
 $Item_extra_status = 'none'; 
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'.$Item->priority(); 
?>" 

it results in this html code:

<div class="bPost bPostprotected3 Item_extra_status_none Item_priority_" lang="de-DE">

as you see, the priority (here: 3) is at the wrong place. i would have expected it as this:

<div class="bPost bPostprotected Item_extra_status_none Item_priority_3" lang="de-DE">

do you see my mistake?

PAT

9 Nov 05, 2006 21:36

Yes. Because what that code is doing is;
echo 'text'.(echo 'something else');
in which case 'something else' is echo'd first.

You want to do (i recomend this one);
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'.$Item->priority;
or
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'; $Item->priority();

10 Nov 05, 2006 22:02

ok, that was the problem, thanks.

two last questions ;) :

1)
do you see an easy way to change the status directly from the blog entry view? i imagine a dropdown list with the different available statuses (similar to the backoffice) and when you change the status, the page reloads.

2)
is there a way, after creating/editing a post in the backoffice, to directly return to the frontend, skipping the "entry changed.." etc page in the backoffice?

PAT

11 Nov 05, 2006 22:17

You can do a little bit of work now, but i'll get you started off ;)

1.
The following code will find out wether the current user can edit the current post;

if( is_logged_in() && $current_User->check_perm( 'blog_post_statuses', $Item->status, false, $Item->blog_ID ) )
{
// the user can modify this post
}

So what you want to do is go extract some html out of the backoffice edit page or whatever into that if statement.

2. Open up the backoffice code, and when you find the appropriate part where it says updating/creating post done or whatever, add the following

<script type="text/javascript" >document.location = '<?php echo $GLOBALS['base_url']; ?>';</script>

Should be good, you could pm EdB and ask him to help out, he loves hacking things up. As i'm actually meant to be studying for my exams next week ;)

12 Nov 05, 2006 22:19

;)

thanks for all the help, good luck with the exams..

PAT

13 Apr 09, 2008 09:04

balupton wrote:

i would imagine you would want something like this;

if you are using the Custom skin, then look for the line;

<div class="bPost bPost<?php $Item->status( 'raw' ) ?>" lang="<?php $Item->lang() ?>">

and replace with

<div class="bPost bPost<?php $Item->status( 'raw' );
$Item_extra_status = $Item->get('t_extra_status');
if ( !$Item_extra_status )
 $Item_extra_status = 'none';
echo ' Item_extra_status_'.$Item_extra_status;
?>" lang="<?php $Item->lang() ?>">

then in it's .css file add something like

.Item_extra_status_unread {
color:yellow;
}

I'm looking for this exact solution but for the glossyblue skin for 2.X
any chance to get this working for this skin ?


Form is loading...