Jump to content

Admin Custom Pages Module


diogo

Recommended Posts

diogo,

Didn't mean any disrespect to this module or it's usefulness — I hope my post didn't come off that way. :)

I used this module for while when you first released it, and I agree it makes the process of creating new admin pages pretty easy.

What I've realized is that the build-in process is really just as easy (IMO). :)

I think you should definitely continue to develop/support the module.

I just wanted to give a quick example of a simple Process Module that is build much like you might in a template.

Link to comment
Share on other sites

Same here. I think one fundamental difference is that admin template (and therefore process modules) doesn't have fields. Admin pages created by this module can have fields (if I have understood correctly how this module works).

Link to comment
Share on other sites

Antti, you can create a normal template (with fields and a template file) for a custom page in the admin, and use $page, $pages, etc. instead of wire()

  • Like 1
Link to comment
Share on other sites

i think there will always be a use for this, even if you can easily create your custom pages in a process module;

the other day i was in a meeting and the client asked for a point-of-sale page in their admin, using foxycart, but with blank fields; so with a few clicks and a 5 line form they had their POS and were able to use it within 10 minutes; i could go now and tighten it up and make it into a process module, but this is a low budget site, so they actually can't afford that.

  • Like 2
Link to comment
Share on other sites

Correct me if I am wrong (can't remember), with this module, for new items, I just need to create another page and assign it it's own template and template file? With Process Module, you would need to install a module each time you want a new item in the Admin....

Edited by kongondo
Link to comment
Share on other sites

With Process Module, you would need to install a module each time you want a new item in the Admin....

You just need to create a new page and assign it the process you want. The methods are pretty much 50/50 on that one.

They both require a new page and some setting to tell that page what template/process to use.

  • Like 1
Link to comment
Share on other sites

I agree — ProcessModules are the way to go. They might look intimidating at first, but if you start with a very simple example, they really are very easy.

Here is a super simple example that lists all pages with the template "news"

@renobird - thanks for posting this; I just converted an admin page that was using this module to a process module, and your example helped... guess i'll be moving on and converting the rest of my admin pages to use process modules... thanks again to everyone posting about this!

  • Like 1
Link to comment
Share on other sites

Macrura,

Glad to have helped. I will warn you, creating simple ProcessModules are a gateway drug. Once you start creating modules, it's addicting. ;)

As has been stated by others, there are definitely cases where using the module is a good choice too.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

Hey Nico!

Cool! Very simple installation!!!

A small bug: There is a missing $this-> on line 71 of FieldtypeAdminCustomPagesSelect.module. It throws an error 'Call to undefined function rglob()' when trying to create the admin page. Should be $thix->rglob()

A minor suggestion: Using the term 'template files' on the select can mislead some; the selection being made is technically a 'template' whose 'template file' will then be rendered :)  ;) .

Thanks! O0  ^-^

Edited by kongondo
Link to comment
Share on other sites

Nico, for what I understand this version wouldn't allow to create custom fields on the page, right? another problem is that, because we create a php file inside templates but not a template for it, this will always be suggested by PW for new templates which might get a bit annoying. If there are solutions for these, I will be glad to merge :)

Link to comment
Share on other sites

Hmm, what I think:

Custom fields: You normally create a custom template file for each of the custom admin pages so I don't think you'd need custom fields here. And if you think about using the same custom admin page template multiple times you can use $page->name to difference them.

Templates: I understand your point but first I don't see them as real templates but as subtemplates. Of course it probably is a bit cleaner to create a template for each. But as you already mentioned: it's really annoying. Especially if you can't use the fields added to the template anyway. I'm not sure which solution is the best one here, so I would go with the easier. If you would prefer to have a template for each file I would rewrite the select field to select templates instead of files from the template folder. (P.S.: I'm not sure if this is an equivalent comparison but admin pages like "setup" don't have a special template, too, only a file rendering the template and stuff like this).

  • Like 1
Link to comment
Share on other sites

Nico, I'm sorry but still didn't have much time to look into this. I'll try to do it later today. I will merge your version since it works well with 2.4, and that's the most important anyway. We can try to fix the details I mentioned later. Thanks for working on this :)

  • Like 3
Link to comment
Share on other sites

So, I accepted Nico's pull request, and his changes are now in the master branch. If someone wants the previous versions, they are in the "pre-nico" and "pre-nico-dev" branches ;)

  • Like 4
Link to comment
Share on other sites

  • 3 weeks later...

FYI diogo, not important, I just spotted a typo in the info on the Modules page, where you link to Nico you've got https and Chrome gets all sulky and jaundiced as the site is http. See, I have my uses—I may be too thick to produce a Module but show me a spelling mistake and I'm ALL over it.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Good day everybody,

 
I'm trying to make Custom Page with one of Pages Tree.
 
 
<?php
$form = $this->modules->get('InputfieldForm'); // prep the form

$wrapper = new InputfieldWrapper; // a wrapper
$wrapper->attr('value', 'List of available articles');

$p = $this->modules->get('ProcessPageList'); // kongondo's code goes here
$p->set('id', 4049); // setting the parent page

$pageTree = new InputfieldMarkup; // the placeholder
$pageTree->value = $p->execute(); // fill the InputfieldMarkup form field...

$wrapper->add($pageTree); // put inside the wrapper...

$form->append($wrapper); // append the wrapper
?>

No success.

The main idea is to give to each user separate space for editing only his pages and prevent access to system pages and pages of other users.

What did I miss?

Thanks for any hints.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...