We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Trying to transform the weblog_select_list output on the publsh page

Development and Programming

hereward's avatar
hereward
91 posts
17 years ago
hereward's avatar hereward

I am trying to respond to a control panel feature request from a client that should be easy to satisfy, but because there are no extension hooks available, this is proving rather difficult.

My task, in a nutshell, is to transform the “publish” page (where you select the weblog you want to publish into) so that the weblogs are grouped in a more attractive manner.

I have found a function called weblog_select_list which appears to be the key to this, but, looking at the way this function’s output combines html presentation with content it looks like it is going to be rather messy.

If EE core functions had separation of presentation from content from logic (including, for example, templates for admin pages) this would all be so much easier.

Any suggestions?

<pre><code> /** Weblog selection menu /** ——————————————–*/ // This function shows a list of available weblogs. // This list will be displayed when a user clicks the // “publish” link when more than one weblog exist. //——————————————–

function weblog_select_list($add='')
{
    global $IN, $DSP, $DB, $LANG, $FNS, $SESS;


    if ($IN->GBL('C') == 'publish')
    {
        $blurb  = $LANG->line('select_blog_to_post_in');
        $title  = $LANG->line('publish');
        $action = 'C=publish'.AMP.'M=entry_form';
    }
    else
    {
        $blurb  = $LANG->line('select_blog_to_edit');
        $title  = $LANG->line('edit');
        $action = 'C=edit'.AMP.'M=view_entries';
    }

    /** -------------------------------------------------
    /**  Fetch the blogs the user is allowed to post in
    /** -------------------------------------------------*/

    $links = array();

    $i = 0;

    foreach ($SESS->userdata['assigned_weblogs'] as $weblog_id => $weblog_title)
    { 
        $links[] = $DSP->table_qrow(($i++ % 2) ? 'tableCellOne' : 'tableCellTwo', $DSP->qdiv('defaultBold', $DSP->anchor(BASE.AMP.$action.AMP.'weblog_id='.$weblog_id.$add, $weblog_title)));
    }

    // If there are no allowed blogs, show a message

    if (count($links) < 1)
    {
        return $DSP->no_access_message($LANG->line('unauthorized_for_any_blogs'));
    }

    $DSP->body .= $DSP->table('tableBorder', '0', '', '100%')
                 .$DSP->table_qrow('tableHeading', $blurb);

    foreach ($links as $val)
    {
        $DSP->body .= $val;     
    }  

    $DSP->body .= $DSP->table_c();

    $DSP->title = $title;
    $DSP->crumb = $title;
}
/* END */[/code]
       
matt romaine's avatar
matt romaine
50 posts
17 years ago
matt romaine's avatar matt romaine

any update on this? what’s the easiest way to reorder the weblogs listing under the publish tab?

       
hereward's avatar
hereward
91 posts
17 years ago
hereward's avatar hereward

I am holding my breath until EE 2.0 arrives.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.