CP as standard selection

With this hack, a content part are defined in the BE as the default choice in the list, the focus (selected) lies in the selection of the registered CP.


Necessary preparations

- as there are:

  1. enter the switch $phpwcms['custom_cp_select'] = CP-No; in conf.inc.php
  2. The file include/inc_lib/backend.functions.inc.php has to be changed a little bit (small hack)



Docu: –
Forum: Default Content Part?

Author: K.Heermann (flip-flop) http://planmatrix.de
(17.08.2010) CMS Version: >= 1.4
Version: V1.0

filename: * include/inc_lib/backend.functions.inc.php

  • config/phpwcms/conf.inc.php


conf.inc.php

This switch determines whether and which content is marked as “selected”. (If the switche is not present it is the same like ”” = off, the default state of the system is generated).

In config/phpwcms/conf.inc.php you'll enter e.g. for the cp “images = No 2”

$phpwcms['custom_cp_select']  = 2; // set selected cp no, list in "include/inc_lib/article.contenttype.inc.php" - default = '' - +KH170810

<note>See the numbers of the Content part Types.</note>


Code snippet (hack)

Enhancement of the file include/inc_lib/backend.functions.inc.php in function “getContentPartOptionTag” around line 454.

This code:

    } else {
        $result .= '<option value="'.$value.'"';
        if($value == $selected) {
            $result .= ' selected="selected"';
            $GLOBALS['contentpart_temp_selected'] = $GLOBALS['temp_count'];
        }
        $result .= '>'.$text.'</option>'.LF;
 
    }

will be replaced by

    } else {
        // ------ +KH 17.08.2010 Patch: set selected cp no
        if ($selected === '' AND isset($GLOBALS['phpwcms']['custom_cp_select'])) $selected = $GLOBALS['phpwcms']['custom_cp_select'];
        // ------ +KH end
        $result .= '<option value="'.$value.'"';
        if($value == $selected) {
            $result .= ' selected="selected"';
            $GLOBALS['contentpart_temp_selected'] = $GLOBALS['temp_count'];
        }
        $result .= '>'.$text.'</option>'.LF;
 
    }


english/other-enhancements/hacks/cp-as-standard-selection.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0