Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
how to add custom build menu to the sidebar
jackmaessen
✭✭✭
I am experimenting with the SimplePages addon Linc made.
What i want to achieve is a custom build menu to the sidebar. I did read that i had to make a module for it.
This is what i have added to the class.simplepages.plugin.php
// No Panel, and allow more styling via body class 'SimplePage' include_once(PATH_PLUGINS.DS.'SimplePages'.DS.'class.simplepagesmodule.php'); // path to module $Sender->AddModule('SimplePagesModule', 'Panel'); // add the module $sender->AddCssFile('plugins/SimplePages/design/simplepages.css'); // add specific css file $sender->CssClass .= ' NoPanel SimplePage'; unset($sender->Assets['Panel']);
What is the code i have to make in class.simplepagesmodule.php?
Or is there another easy way to add the menu to the sidebar?
Look here what i mean: http://forum.webprofis.nl/tuts-en-scripts#one3
0
Comments
an example.
1 remove the NoPanel from the CssClass
$sender->CssClass .= ' NoPanel SimplePage';
becomes
$sender->CssClass .= ' SimplePage';
// unset($sender->Assets['Panel']);
3 render before discussion , unset specific modules and add your own.
-4 create SimplePages/class.simplepagesmenumodule.php
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
which leads to a question (which hgtonight explained once that you don't need to use include for the module).
which works if the module is in
SimplePages/class.simplepagesmenumodule.php
but doesn't seem to work if
SimplePages/modules/class.simplepagesmenumodule.php
@Linc or anyone else with the savoir-faire
how come the autoloader doesn't search the modules folder for module
or am I confused?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
It should IIRC. Make sure you clear your plugin cache maps of you move things around to force the map be rebuilt.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I seem to recall running into this recently, where the
modules
folder autoloads for applications but not plugins. Plugins got the shaft on several things like this that we've slowly been fixing, like the controllers limitation we removed. I'd accept a pull request that resolved it well.Eventually we'd like to phase out applications and make plugins first-class citizens with all of their powers.
Bingo for hgtonight!
I disabled the plugin, moved the module in to modules folder. enabled the plugin and it worked.
This has been the bane for me, not realizing that I have to disable plugin when messing with modules and moving around. I've spent hours in the past messing with this, sometimes things worked and sometimes they didn't for no apparent reason. The rule I tell other people "Disable your plugin when making changes and enable, I had not learned myself . In the past I only disabled and enabled when messing with structure, permissions, and routing. Now I add a fourth messing with modules.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I'm using a simple plugin for quite some time now, which I always "use" if I sense some behavior as kind of strange:
@peregrine This works great! Thanks again for help
There was one thing i had to solve: this menu appears on every page in the sidebar.
Actually i would like it only being displayed on the pages made with simplepages plugin.
So i added in my general style.css:
And i put in a simplepages.css:
Now the wrapper appears only on the pages made with simplepages plugin
simple and nice! good idea.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I overlooked that.
if you want that routine only on simple pages. a simper way to do it
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine that's more efficient; i agree! thanks again
This is bad form as you are relying on PHP's truthiness of strings to evaluate the return.
You should use something like:
This forces it to only keep going when the type is simplepage since
strtolower()
returns a string and!==
forces type checking.If you don't do something like this, the function will still be executed on discussions that have any "truthy" string set as the type. E.g. pretty much anything.
More on PHP truthyness here: http://php.net/manual/en/types.comparisons.php
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
good idea. might want to modify the existing plugin code line 77 as well.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.