You are not logged in.
Pages: 1
Modification
This will add a extra option to Pluck............a sub menu for Pluck.
Sub menu title and content can be changed dynamically by editing the page title and content in Pluck admin.
---------------------------------------------------------------------------------------
Edit 02-26-2010
new download for changes see post #2
dowload:
pluck_4.6.x_submenu
pluck_4.6.x_submenu_02-26-2010_unzip_first.zip
contents:
modified php files
pluck theme evergreen with submenu
puck-submenu.pdf
Note:
Upload the contents with your favourite FTP program to pluck
only the theme what's included can be installed trough the backend of Pluck admin
---------------------------------------------------------------------------------------
The following files are modified for Pluck SubMenu
Edit these files:
index.php
data/inc/
editpage.php
functions.admin.php
newpage.php
page_editmeta.php
post_get.php
data/inc/lang/en.php
in theme.php (see also Theming guide)
add this line:
<?php theme_submenu('<li><a href="#file" title="#title">#title</a></li>'); ?>add the function: theme_submenu in index.php
added lines in: index.php
//[THEME] FUNCTION TO SHOW THE SUBMENU
//---------------------------------
function theme_submenu($html,$htmlactive = NULL) {
$dir = 'data/settings/pages';
$path = opendir($dir);
while (false !== ($file = readdir($path))) {
if(($file !== ".") and ($file !== "..")) {
if(is_file($dir."/".$file))
$files[]=$file;
else
$dirs[]=$dir."/".$file;
}
}
if($files) {
//Sort the array
natcasesort($files);
foreach ($files as $file) {
if (isset($_GET['file'])) {
$currentpage = $_GET['file'];
}
include('data/settings/pages/'.$file);
//Only display in submenu if page is submenu
if ((isset($submenu)) && ($submenu == 'yes')) {
//Check if we need to show an active link
if ((isset($currentpage)) && ($currentpage == $file) && ($htmlactive)) {
$html_new = str_replace("#title", $title, $htmlactive);
$html_new = str_replace("#file", "?file=$file", $html_new);
echo $html_new;
}
else {
$html_new = str_replace("#title", $title, $html);
$html_new = str_replace("#file", "?file=$file", $html_new);
echo $html_new;
}
}
}
}
closedir($path);
}changed lines in newpage.php and editpage.php 02/26/2010 improved code by a_bach
//Options div
echo "<div style=\"background-color: #f4f4f4; width: 600px; padding: 5px; border: 1px dotted gray; margin: 5px;\">
<table>
<tr>
<td><img src=\"data/image/options.png\" border=\"0\" alt=\"\" /></td>
<td>
</tr>
<tr>
<td><span class=\"kop3\">$lang_contact2</span><br />";
//Display checkbox for the hidepage-option #improved Code by a_bach#
if ($hidden == 'no')
echo "<input type=\"checkbox\" name=\"hidepage\" value=\"no\" checked> $lang_pagehide1<br />";
else
echo "<input type=\"checkbox\" name=\"hidepage\" value=\"no\"> $lang_pagehide1<br />";
if ($submenu == 'yes')
echo "<input type=\"checkbox\" name=\"submenupage\" value=\"yes\" checked> $lang_submenu1<br />";
else
echo "<input type=\"checkbox\" name=\"submenupage\" value=\"yes\"> $lang_submenu1<br />";
echo "
</td>
</tr>
<td>";
//Display checkbox for the submenu-option
echo "
</td>
</tr>
</table>
</div>";
//Submit button
echo "<input type=\"submit\" name=\"Submit\" value=\"$lang_install13\" />
<input type=\"button\" name=\"Cancel\" value=\"$lang_install14\" onclick=\"javascript: window.location='?action=page';\" />
</form>";
//If form is posted...
if(isset($_POST['Submit'])) {
//Check if we want to show the page in the menu
if ($hidepage != "no") {
$hidepage = "yes";
}
//Check if we want to show the page in the menu
if ($submenupage != "yes") {
$submenupage= "no";
}
//Now we have to check which filenames are already in use
if (file_exists("data/settings/pages/kop1.php")) {
$i = 2;
$o = 3;
while ((file_exists("data/settings/pages/kop$i.php")) || (file_exists("data/settings/pages/kop$o.php"))) {
$i = $i+1;
$o = $o+1;
}
$newfile = "data/settings/pages/kop$i.php";
}
else {
$newfile = "data/settings/pages/kop1.php";
}
$data = $newfile;
include("data/inc/page_stripslashes.php");
//Sanitize data
$kop = htmlspecialchars($kop);
$file = fopen($data, "w");
fputs($file, "<?php
\$title = \"$kop\";
\$content = \"$tekst\";
\$hidden = \"$hidepage\";
\$submenu = \"$submenupage\";");changed lines in: functions.admin.php
//Function: save a page.
//-------------------
function save_page($name, $title, $content, $hidden = false, $submenu = false) {
//Check if the file should be hidden.
if ($hidden == true)
$hidden = 'yes';
else
$hidden = 'no';
if ($submenu == false)
$submenu = 'no';
else
$submenu = 'yes';
$data = 'data/settings/pages/'.$name.'.php';
$file = fopen($data, 'w');
$title = stripslashes($title);
$title = str_replace('"', '\"', $title);
$content = stripslashes($content);
$content = str_replace('"', '\"', $content);
fputs($file, '<?php'."\n"
.'$title = "'.$title.'";'."\n"
.'$content = "'.$content.'";'."\n"
.'$hidden = "'.$hidden.'";'."\n"
.'$submenu = "'.$submenu.'";'."\n" //**
.'?>');
fclose($file);
chmod($data, 0777);
}changed lines in: page_editmeta.php
if(isset($_POST['Submit'])) {
$data = 'data/settings/pages/'.$editmeta.'';
include('data/inc/page_stripslashes.php');
$file = fopen($data, 'w');
fputs($file, '<?php'."\n"
.'$title = "'.$title.'";'."\n"
.'$content = "'.$content.'";'."\n"
.'$hidden = "'.$hidden.'";'."\n"
.'$submenu = "'.$submenu.'";'."\n");
//Only save other variables if they are setchanged lines in: post_get.php
//POSTS
$kop = $_POST['kop'];
$tekst = $_POST['tekst'];
$back = $_POST['back'];
$txt = $_POST['txt'];
$type = $_POST['type'];
$cont = $_POST['cont'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$chosen_lang = $_POST['chosen_lang'];
$email = $_POST['email'];
$email2 = $_POST['email2'];
$contactform = $_POST['contactform'];
$hidepage = $_POST['hidepage'];
$submenupage = $_POST['submenupage'];
$album_name = $_POST['album_name'];
$quality = $_POST['quality'];
$incmodule = $_POST['incmodule'];
//Some variables for general useAdd new line in data/inc/lang/en.php
//VERSION 4.6 NEW
//---------------
$lang_submenu1 = "show page in submenu";Theme:
don't forget to style your new submenu layer in style.css
existing websides
When everything is done, go to Pluck admin --> login
go to:pages Here you can manage, edit and delete your pages
open the existing pages and save them again with your wanted preferences (show page in menu and / or show page in submenu)
when done the extra line
'$submenu = "yes"' is written to kop1.php, kop2 .php,............ etc.
for fresh installations this is not needed!
of course you can add your own translation in your language example for German you add the translation in de.php
Used editor: Notepad ++
regards mecano
Last edited by mecano (28-02-2010 14:23:43)
Offline
pluck_4.6.x_submenu_unzip_first.zip:
--------------------------------------------------------------------------------------------------------------
contents:
modified php files
pluck theme with submenu
puck-submenu.pdf
--------------------------------------------------------------------------------------------------------------
changes:
--------------------------------------------------------------------------------------------------------------
02-26-2010 Modification by a_bach check box submenu (pluck admin) check box will stay checked when editing page.
02-24-2010 packed with zip instead tar.gz to prevent installing trough the backend of Pluck admin
02-10-2009 added pluck theme with submenu and puck-submenu.pdf
02-12-2009 Correction theme styling in readme.txt and added Polish translatioPolish translation by A_Bach
Last edited by mecano (27-02-2010 10:21:16)
Offline
good job
respect !
it dont work for me, i think i did something wrong. Maybe you can post here your changed files so we could download
thx
one more thing. Can you show page where we could see how it works ![]()
Last edited by Tadziz (09-02-2009 15:15:48)
Offline
ROCK 'N ROLL - Works a treat!! and its fits into my new theme perfectly.
Many Thanks - Great work
Offline
Is it me? - or does each page now default to "Show page in menu;" - so that if you edit a "submenu" page, you have to uncheck "Show in menu" and recheck "Show in submenu" - Not a problem now I know to check for it......... but if it is a bug, just letting you know about it. ![]()
Offline
Edit 02/26/2010
problem solved
see new download
good luck
regards mecano
Last edited by mecano (27-02-2010 10:27:25)
Offline
Hey Mecano,
You have taken Pluck to the next level with this hard work. I tried the above coding by hand but even though everything else seemed in place the link didn't show. But replacing my files with the ones I downloaded from above set the ball rolling.
Good job.
Offline
@ JGMetcalfe
Nice theme's you created for Pluck with sub-menu
Your site is really a recommendation!!
THX
Last edited by mecano (23-02-2009 11:44:00)
Offline
Result looks great, mecano! I hope to find time to take a look at your code soon. Unfortunately, I don't have much time at the moment. ![]()
Offline
Wow, just downloaded changes and installed. What a great addition. I wish I had that kind of expertise with php. Just bought my first book this week. I am going to update my themes this week. Thank you mecano. I really think this should be added to the current release immediately, for all to use.
Last edited by superdad (26-02-2009 18:13:47)
Offline
Where is module_info.php?
Offline
At last I figured out how it works. Thanks a lot.
Works fine.
Last edited by ragou (19-07-2009 20:26:46)
Offline
thank's, very good ![]()
I had this error with the checkeds and I have did:
//added in line 44:
//Check if we have to check the submenu checkbox
if (($submenu == "yes") || (!$submenu)) {
$hidecheck2 = "checked";
}
else {
$hidecheck2 = "";
}
//changed in input checks:
//Display checkbox for the hidepage-option
echo "<input type=\"checkbox\" name=\"hidepage\" value=\"no\" $hidecheck> $lang_pagehide1;
</td>
</tr>
</td>
<td>";
//Display checkbox for the submenu-option
echo "<input type=\"checkbox\" name=\"submenupage\" value=\"yes\" $hidecheck2> $lang_submenu1<br />
</td>
</tr>
</table>
</div>";
Last edited by westial (08-08-2009 20:59:48)
Offline
Hi, new to pluck and must say i love it. Easy to configure and good description on how to make your own theme. Now to my question about the submenu.
Is it possible to have the submenu on one page only? As i get it now the submenu is on every page, i want to be able to configure it like this:
My main page
Different sodas, and on this page submenu with Coca Cola, Pepsi and so on.
Is this possible?
And btw this was just an example, not doing a site about sodas, just drank a bottle now ![]()
Offline
Yes and no. At least for me.
http://pluck.ekyo.pl/en/5.Modules.php
You can download the multitheming modification and the submenu modification. Um... I can't seem to get it to work together though, so I use the multitheming and custom designed a page with the links. Bad though if you change the order of the pages - you'd also have to update the custom page. But works good for me.
Maybe someone can help you get both to work together. I was pointed in the right direction by a_bach but I must have done something wrong because I could never get both to work together. Anyway, do the submenu first and then follow the directions here:
http://www.pluck-cms.org/forum/viewtopi … 2639#p2639
Hopefully, it will work for you.
PS. If anyone else reads this and gets both to work, please let me know. ![]()
Offline
When I try to install the submenu module in the latest version I get the message that the module does not work with your version of Pluck. What is the solution?
Offline
When I try to install the submenu module in the latest version I get the message that the module does not work with your version of Pluck. What is the solution?
Submenu is not a module - is modification. Dont install it - you will have to repalce manualy some files on ftp.
Offline
thank's, very good
I had this error with the checkeds and I have did:>......cut......< code not quoted
Thanks for pointing at this
code is changed and available in a new download (improved code by a_bach)
greetings mecano ![]()
Last edited by mecano (27-02-2010 10:15:56)
Offline
I have the same problem as hydex in 4.6.4. After implementing the submenu, every page I edit gets duplicated after saving. It is very annoying but the submenu itself works.
Last edited by tonyp (13-11-2010 18:20:02)
Offline
hi, i would like to use this plugin as it would almost exactly fit my needs of a submenu, but when i try installin it in version 4.6.4 i cannot access anything anmore. the Browser just shows
"Access denied"
Has anyone encountered this before - and an idea on how to solve it?
Offline
hi, i would like to use this plugin as it would almost exactly fit my needs of a submenu, but when i try installin it in version 4.6.4 i cannot access anything anmore. the Browser just shows
"Access denied"
Has anyone encountered this before - and an idea on how to solve it?
Edit module_info.php file and change
$module_compatibility = "4.6.3";into
$module_compatibility = "4.6.4";
Copy and pasted from a reply that a_bach made in another post.
Offline
thank you for the reply, but i think this won't work, because submenus is a modification and not a module and as such doesn't have a file called module_info.php
in the normal modules already stands: $module_compatibility = "4.6";
I'll go ahead and look into the code, but i fear my knowledge of php is too little to find out why it is not working ![]()
Offline
I think i found it
*Argh* No i didn't! i still get another error:
"Cross-site request forgery detected."
pluck checks in all files wether a variable 'IN_PLUCK' is defined. this is to make sure the file isn't accessed directly. in all the files of the modification this check is done differently and in the modified index.php not at all.
so i changed/allded in all the files of the modification:
defined('IN_PLUCK') or exit('Access denied!');
Now i will try finding out where the new error comes from.... any help/ideas appreciated
edit2: acutally i can add and edit pages, just get this error everytime i try to save a page.
Last edited by niobe (07-12-2010 18:13:33)
Offline
Pages: 1