madalin Posted May 15, 2014 Share Posted May 15, 2014 Hello there! I'm new to Processwire (like almost 2 days from my first look at the code and admin interface) but i am already in love with it! Well... how much i already love the ideea, i can't manage to create a page under the admin page to show as tab with some functionality. (actually the page is created but i don't know how to add the functionality i want) I want a custom admin page with fields (text, checkbox, textarea) that i could set trough that page and use them global ( example: set my facebook page url from this custom settings page and display it on my public site) Can somebody give me some instructions? Link to comment Share on other sites More sharing options...
kongondo Posted May 15, 2014 Share Posted May 15, 2014 Hi Madalin, Welcome to ProcessWire and the forums! There are a number of ways to achieve this. If it is only a settings page, then you can create the page as a direct child of Admin. I don't know what you mean by "to show as tab with some functionality" but the page should show up as a menu item in Admin. You will need to have a template for that page, of course. Add as many fields as you want to that template that will be used by your "settings" page. You can then pull up data from that page using the PW API, in this case you would want to use $pages since pages in Admin cannot be accessed directly in the frontend (so no $page). To output your settings fields...example.. echo $pages->get(12345)->title//Here, 12345 is the ID of your settings page. You can also retrieve the page by its path or title or name... Have a read here http://processwire.com/api/variables/pages/ http://processwire.com/api/variables/page/ 2 Link to comment Share on other sites More sharing options...
madalin Posted May 15, 2014 Author Share Posted May 15, 2014 To output your settings fields...example.. echo $pages->get(12345)->title//Here, 12345 is the ID of your settings page. You can also retrieve the page by its path or title or name... Have a read here http://processwire.com/api/variables/pages/ http://processwire.com/api/variables/page/ Thank you! I have understand that but i still have some problems. Let's say i have http://localhost/processwire/admin/settings/ (where settings is my custom created page) What is the Process i have to asign to this page and how can i create the template to be shown only to admin interface? Link to comment Share on other sites More sharing options...
kongondo Posted May 15, 2014 Share Posted May 15, 2014 (edited) "process to assign....": This tells me you are assigning your 'settings' page the 'wrong' template. Do not assign it the admin template. 1. First create your own template (no need for a template file; just the template). Call that template, say 'settings'. 2. Add the fields you want to that template. 3. Go to Admin (I mean the page Admin in the page tree), create a new page under the 'admin' page. Call it 'settings', give it the template 'settings'....you are good to go.. .... Pages under admin can only be seen by the 'supersuser' - so, no worries that people with the wrong permissions will see it . In addition, as I stated, these pages cannot be directly accessed via the frontend + your page will not have a template file....(not that it matters since this is an 'admin' page). Have you read up on the docs about how PW works? If not, you might want to do that first Edited May 15, 2014 by kongondo 2 Link to comment Share on other sites More sharing options...
madalin Posted May 15, 2014 Author Share Posted May 15, 2014 Setup> Templates > Add new template Setup > Fields > Add new field Thank you, it worked! But notice in the last image the Site Settings link from the menu has disappeared... How to put it back there? Also... to view this page i need to access http://localhost/processwire/admin/page/edit/?id=1006 Is there a way to view that page at this custom url http://localhost/processwire/admin/settings/ ? Link to comment Share on other sites More sharing options...
kongondo Posted May 15, 2014 Share Posted May 15, 2014 Thank you, it worked! But notice in the last image the Site Settings link from the menu has disappeared... How to put it back there? It seems you unpublished the page? Also... to view this page i need to access http://localhost/processwire/admin/page/edit/?id=1006 Is there a way to view that page at this custom url http://localhost/processwire/admin/settings/ ? You are in the backend, one that only you can see, why does it matter to see a pretty URL? OK, what is happening is this. When 'viewing' a page like the one you've created in admin, what you are actually doing is editing it...hence the .../edit/?id=1006. If you want something like .../admin/settings/ what you need is to create a process module or use some other modules available for PW. I am inclined to think, though (apologies if I am wrong) that you are a newbie to PHP as well? I am hesitant to point you to advanced stuff until you at least learn the basics of PW Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted August 4, 2015 Share Posted August 4, 2015 It seems you unpublished the page? You are in the backend, one that only you can see, why does it matter to see a pretty URL? OK, what is happening is this. When 'viewing' a page like the one you've created in admin, what you are actually doing is editing it...hence the .../edit/?id=1006. If you want something like .../admin/settings/ what you need is to create a process module or use some other modules available for PW. I am inclined to think, though (apologies if I am wrong) that you are a newbie to PHP as well? I am hesitant to point you to advanced stuff until you at least learn the basics of PW Here's a tip for making your global settings / global options page easily accessible in the admin, without having to create a custom process module or going to the page using the pagetree. Let's say the page name of your settings page is called "settings" and it's directly under home. Now, create a *new* page under the admin page in ProcessWire. Use the "admin" template. Call this page "settings" as well. After saving, it will now give you the option to choose which process module this admin page will utilize. Choose "ProcessPageEdit". Now you will have a link in the main navbar to this Settings page, but when you go to it, it will error saying "Unknown page" + "the process returned no content". What you need to do is make this page load the /settings/ page you originally made. Using the special "/site/ready.php" file (create ready.php if it doesn't exist), you can add the following line of code to it: if($page->template=="admin" && $page->name=="settings") $input->get->id = $pages->get("/settings/")->id; Now go to the Settings page in the navbar. Nice, easy and "official" feeling. 8 Link to comment Share on other sites More sharing options...
mr-fan Posted August 4, 2015 Share Posted August 4, 2015 a other option for own admin pages with custom stuff....would be the AdminCustomPages Module https://processwire.com/talk/topic/3474-admin-custom-pages-module/ so you could assign the process AdminCustomPage and choose a "normal" PHP Template....but this not shows up the /settings/ page - this could be used for own output and dashboard like views that could be easy created without the need of a own module in the backend.... For editing /settings/ pages that are not under the /admin/ branch jlahijani's tip should do this.. @jlahijani if you got the time you could send this to the https://processwire-recipes.com/ project...it's a god home for such good hints... regards mr-fan 1 Link to comment Share on other sites More sharing options...
Macrura Posted August 4, 2015 Share Posted August 4, 2015 @jlahijani - thanks for this, i should add your technique to my settings tutorial.. how do you do settings, e.g. table, text field, regular fields, etc.. https://processwire.com/talk/topic/8373-use-delimited-texarea-table-or-yaml-for-settings/?hl=settings **just set this up and it works great! (i was using a custom admin page before for this and doing a session redirect..) Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 5, 2015 Share Posted August 5, 2015 You could even hide potential "Children", "Settings" or "Delete" Tabs. Link to comment Share on other sites More sharing options...
tekno Posted August 18, 2015 Share Posted August 18, 2015 i create ready.php file and wrote this codes but nothing changed? is it difference between versions? what is it ready.php under /site/ directory? still error saying "Unknown page Link to comment Share on other sites More sharing options...
horst Posted October 10, 2015 Share Posted October 10, 2015 the ready.php is a new thing, introduced in the current 2.6.7 DEV branch. If you are running PW with a lower version number, it isn't usable then. read more in the blog post here: https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/ Link to comment Share on other sites More sharing options...
rjgamer Posted September 1, 2019 Share Posted September 1, 2019 Hi folks, is there any "better" solution for global settings today as written in this thread? I've a few input fields like website_title and website_image which I want to be editable trough a admin page (e.g. setup > settings) and accessible in my template (e.g. $settings->website_title) Best regards, rjgamer Link to comment Share on other sites More sharing options...
dragan Posted September 1, 2019 Share Posted September 1, 2019 https://processwire.com/talk/topic/14112-general-site-settings-module/ https://processwire.com/talk/topic/17536-settings-factory/ https://modules.processwire.com/modules/textformatter-multi-value/ https://processwire.com/store/pro-fields/textareas/ 2 Link to comment Share on other sites More sharing options...
rjgamer Posted September 1, 2019 Share Posted September 1, 2019 Thanks for your links. I already know these solutions. But they are not "user friendly" for non-technical users. General site settings module is buggy in latest PW dev version and settings factory does not offer a solution based on uikit formatted input forms. The solution written in this post is perfect for my use case, but I want to prevent to create mulitple settings page under home and admin, only to get it accessible trough "setup > settings". Offtopic: Cool zgseh dass oh Schwiizer hie mit mache ? Link to comment Share on other sites More sharing options...
dragan Posted September 1, 2019 Share Posted September 1, 2019 Well, feel free to write your own module then. It ain't so hard, really. 1 1 Link to comment Share on other sites More sharing options...
rjgamer Posted September 1, 2019 Share Posted September 1, 2019 Cool. Thanks. I think it is the only way for me and my customers to create a own module. Link to comment Share on other sites More sharing options...
bernhard Posted September 1, 2019 Share Posted September 1, 2019 6 hours ago, rjgamer said: is there any "better" solution for global settings today as written in this thread? Did you try this solution? On 8/4/2015 at 6:50 PM, Jonathan Lahijani said: Here's a tip for making your global settings / global options page easily accessible in the admin, without having to create a custom process module or going to the page using the pagetree. Let's say the page name of your settings page is called "settings" and it's directly under home. Now, create a *new* page under the admin page in ProcessWire. Use the "admin" template. Call this page "settings" as well. After saving, it will now give you the option to choose which process module this admin page will utilize. Choose "ProcessPageEdit". Now you will have a link in the main navbar to this Settings page, but when you go to it, it will error saying "Unknown page" + "the process returned no content". What you need to do is make this page load the /settings/ page you originally made. Using the special "/site/ready.php" file (create ready.php if it doesn't exist), you can add the following line of code to it: if($page->template=="admin" && $page->name=="settings") $input->get->id = $pages->get("/settings/")->id; Now go to the Settings page in the navbar. Nice, easy and "official" feeling. 3 hours ago, dragan said: Well, feel free to write your own module then. It ain't so hard, really. ProcessModules are great for custom user interfaces, but a settings page is - at least how I understand it - primarily for storing some data. That's a little harder to do using ProcessModules and it's exactly what ProcessPageEdit is built for. So I think the solution described by @Jonathan Lahijani is still the best option. 1 Link to comment Share on other sites More sharing options...
rjgamer Posted September 1, 2019 Share Posted September 1, 2019 Hi, yeah, I saw it. But I don't like it, that you have to create a "settings" page under home to store the data. This is very iritiating for a dummy user. Is there no solution to create a hidden "settings" page and then map it to the admin page? Link to comment Share on other sites More sharing options...
szabesz Posted September 1, 2019 Share Posted September 1, 2019 1 hour ago, rjgamer said: I don't like it, that you have to create a "settings" page under home Normally I create more than that under home anyway, such as custom assets, tags, categories, etc... Normally I create a page under home called something like "Internal" – and move it to be the last one – to signal that pages under that do not directly map to public pages, and I explain it to the client. As it is a simple concept, even the less technically minded had no issues understanding it so far. 1 1 Link to comment Share on other sites More sharing options...
rjgamer Posted September 1, 2019 Share Posted September 1, 2019 48 minutes ago, szabesz said: Normally I create more than that under home anyway, such as custom assets, tags, categories, etc... Normally I create a page under home called something like "Internal" – and move it to be the last one – to signal that pages under that do not directly map to public pages, and I explain it to the client. As it is a simple concept, even the less technically minded had no issues understanding it so far. You are right. I've tested a lot of solutions in last few hours. It seems to be the fastest, most user-friendly and most flexible way to get it done without any third-party module or core manipulation. 1 Link to comment Share on other sites More sharing options...
jonassalen Posted October 12, 2019 Share Posted October 12, 2019 I don't know how, but the item in the sidebar ('settings') now keeps linking to /admin/page/settings/bookmarks/ On other sites I made this isn't the problem. Anyone with he same problem? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now