WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • General Community »
  • Global WebsiteBaker 2.8.x discussion »
  • Suggestion - add new page to correct menu
  • Print
Pages: [1]   Go Down

Author Topic: Suggestion - add new page to correct menu  (Read 8828 times)

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
Suggestion - add new page to correct menu
« on: May 18, 2010, 08:03:20 AM »
In the admin/pages/add.php file is a section of code that adds a new page, lines 120 - 138 ...

Code: [Select]
// Work-out if the page parent (if selected) has a seperate template or language to the default
$query_parent = $database->query("SELECT template, language FROM ".TABLE_PREFIX."pages WHERE page_id = '$parent'");
if($query_parent->numRows() > 0) {
$fetch_parent = $query_parent->fetchRow();
$template = $fetch_parent['template'];
$language = $fetch_parent['language'];
} else {
$template = '';
$language = DEFAULT_LANGUAGE;
}

// Insert page into pages table
$query = "INSERT INTO ".TABLE_PREFIX."pages (page_title,menu_title,parent,template,target,position,visibility,searching,menu,language,admin_groups,viewing_groups,modified_when,modified_by) VALUES ('$title','$title','$parent','$template','_top','$position','$visibility','1','1','$language','$admin_groups','$viewing_groups','".time()."','".$admin->get_user_id()."')";
$database->query($query);
if($database->is_error()) {
$admin->print_error($database->get_error());
}

Can I suggest that instead of always inserting "1" for the menu, can this be modified to insert the parent link menu value.

For a multi-menu template it is annoying to have to reset the new page to the correct menu when the value is already known.

Suggested mod...

Code: [Select]
// Work-out if the page parent (if selected) has a seperate template or language to the default
$query_parent = $database->query("SELECT template, language, menu FROM ".TABLE_PREFIX."pages WHERE page_id = '$parent'");
if($query_parent->numRows() > 0) {
$fetch_parent = $query_parent->fetchRow();
$template = $fetch_parent['template'];
$language = $fetch_parent['language'];
$menu = $fetch_parent['menu'];               //GWB
} else {
$template = '';
$language = DEFAULT_LANGUAGE;
  $menu = 1;                                  //GWB
}

// Insert page into pages table
$query = "INSERT INTO ".TABLE_PREFIX."pages (page_title,menu_title,parent,template,target,position,visibility,searching,menu,language,admin_groups,viewing_groups,modified_when,modified_by) VALUES ('$title','$title','$parent','$template','_top','$position','$visibility','1','$menu','$language','$admin_groups','$viewing_groups','".time()."','".$admin->get_user_id()."')";
$database->query($query);
if($database->is_error()) {
$admin->print_error($database->get_error());
}
« Last Edit: May 18, 2010, 08:53:01 AM by PurpleEdge »
Logged

Offline crnogorac081

  • Posts: 2162
  • Gender: Male
Re: Suggestion - add new page to correct menu
« Reply #1 on: May 18, 2010, 09:31:04 AM »
I find this very usable..
Logged
Web developer

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Suggestion - add new page to correct menu
« Reply #2 on: May 18, 2010, 11:09:06 AM »
Might I suggest adding the parents template as well, and maybe even parents visibility?

John
Logged
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
Re: Suggestion - add new page to correct menu
« Reply #3 on: May 18, 2010, 11:27:38 AM »
The parent template is already used in the sql statement, and visibility is a value on the form when creating the page, so I think they are both OK?
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Suggestion - add new page to correct menu
« Reply #4 on: May 18, 2010, 04:39:13 PM »
Hmm didn't see it, must have dirt im my eyes :P
but yes, they are there ;)

John
Logged
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
Re: Suggestion - add new page to correct menu
« Reply #5 on: May 19, 2010, 08:10:22 AM »
Is there a process to get this implemented in future releases?
Logged

erpe0812

  • Guest
Re: Suggestion - add new page to correct menu
« Reply #6 on: May 19, 2010, 09:14:38 AM »
You can open a ticket and hope, that someone finds it useful............ :wink:
http://project.websitebaker2.org/newticket

rgds

erpe
Logged

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
Re: Suggestion - add new page to correct menu
« Reply #7 on: May 19, 2010, 09:35:47 AM »
Done, easier than modifying WB on every release!  :-)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • General Community »
  • Global WebsiteBaker 2.8.x discussion »
  • Suggestion - add new page to correct menu
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2