-
Posts
2,769 -
Joined
-
Last visited
-
Days Won
31
Everything posted by Martijn Geerts
-
Without running your code I have just a question: Are you sure that $f->type is a string ? really sure it's not an object ? Have to say that options field is a little bit weird. $options = $f->getOptions(); foreach ($options as $key => $option) { if ($field->isOptionSelected($key)) { $the_value = $option; break; } }
-
Think Horst or someone who is more knowledgeable then me will respond soon.
-
What PW version do you use?
-
I also want to mention that you also can use a file name as PageProcessEditChangeView.js, it's a little more verbosity in the filename but it gives you the flexibility to separate different tasks in separate files.
-
Most of the time this wire method is not accessed as a constructor. I'll report this one on GitHub.
-
Populate page from fields on web page
Martijn Geerts replied to Peter Knight's topic in Getting Started
I want to mention that before you save data (1) You need to know what the data is. (2) Know if it is save to store. -
Preconfigured Lister in Custom Admin Page
Martijn Geerts replied to Spica's topic in Getting Started
Hi adrianmak, here's a good read: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module It's not that don't want to fish and cook for you, but fishing your self will give you more experience. -
How to use pw to create a guestbook like functionality ?
Martijn Geerts replied to adrianmak's topic in General Support
Three underscores make them hookable. -
How to use pw to create a guestbook like functionality ?
Martijn Geerts replied to adrianmak's topic in General Support
You have something like this: ? public static function getModuleInfo() { return array( 'title' => 'Your title', 'summary' => 'What you want to say.', 'version' => '0.0.7', 'author' => 'adrianmak', // Do you have this ? 'page' => array( 'name' => 'yourname', 'parent' => 'setup', 'title' => 'Your title', ), ); } BTW, When you don't do anything in public function install() or uninstall, you don't need to use them... -
How to use pw to create a guestbook like functionality ?
Martijn Geerts replied to adrianmak's topic in General Support
And does the file ends with the .module extension ? -
If Page is selected, display Output
Martijn Geerts replied to louisstephens's topic in API & Templates
Thanks Ivan for making me smile You just have made my day a little bit better ! -
That's true that limitation is here: https://github.com/ryancramerdesign/ProcessWire/blob/980ce4f0be2054dfbad4a7b334d35bdca42da7da/wire/core/Pages.php#L987 That limitation is there for a good reason as you can see from the code. (needs to do a count on every iteration) I think it's better not to rely on automatic page name when you have that amount of pages with the same title. Maybe you can incorporate the creating date or something to make it more unique, and then write a while loop yourself to make it unique for that date. Or set the title with the date, save the page, change the title to the wished title and save again.
-
If Page is selected, display Output
Martijn Geerts replied to louisstephens's topic in API & Templates
// You need to to have the setting set: return null page if none selected. // When there's no page, a nullpage is returned, that page has ID 0, thus evaluates to false if ($myVariable->pageField->id) echo "<a href='{$myVariable->pageField->url}'>Link to Selected Page</a>"; -
Just to clarify a few things what is maybe not so obvious when coming from an other CMS. So maybe it's not relevant in your context at all. Anyway ;-), in ProcessWire there's no central place where the CMS stores the files/images (let's call them assets for now). All assets are stored on disk with a page id as reference. The storage of the assets always happen with the field, so that the field is fully responsible for that image. When you delete an image from your field, the image will be deleted from the disk. So when you have a textual reference to the filename but the file is not there anymore, the link is broken. I my self never use images in CKEditor, so I never need to upload images in the context of the CKEditor. However as said before, fields are responsible for the assets, so I guess that behind the scene CKEditor will give the task to a field to upload & store the assets.
-
When using the Forms API $form->processInput($input->post); will proces the input, but also pre-populate the ->value(s) of the fields.
-
Admin Page with id = 2, That page executes the ProcessHome module.
-
Yep, you could do. But I would recommend to use Javascript for that instead of CSS. When you check the javascript config checkbox, you can access the roles in your javascript file with: config.AdminCustomFiles.user.roles
-
Make dashboard plugin page the default admin page
Martijn Geerts replied to kriegar's topic in General Support
Something like this will redirect you. (not tested) class RedirectToDashboard extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => "Redirect To Dashboard", 'version' => "0.0.1", 'summary' => "Redirect", 'autoload' => true, 'singular' => true, ); } public function init() { $this->addHookBefore("ProcessHome::execute", $this, "redirectTo"); $this->addHookBefore("ProcessPagelist::execute", $this, "redirectTo"); } public function redirectTo($event) { if (!$this->user->isSuperuser()) { $this->wire('session')->redirect('/processwire/setup/dashboard/'); } } } -
$pages->find(selector) always return true
Martijn Geerts replied to adrianmak's topic in General Support
Thats true... as it should. when using: if ($childpages) you ask: If PageArray... which is always true. You should check if it contains pages with count for example. if (!count($childpages)) { // The pageArray doesn't contain pages // If not count pages, thus 0 } if (count($childpages)) { // yay we have at least 1 page } // or if ($childpages->count()) { // yay we have at least 1 page } -
Using $page->render() on unpublished pages return 500 Error
Martijn Geerts replied to Lars282's topic in General Support
if ($page->draft_article) will always return true, no matter if it is published or not. Remember that $page->draft_article is an object, so you're asking if (object) Probably you're better of with: $page->draft_article->viewable() or $page->draft_article->editable() or something. if ($page->draft_article->id && $page->draft_article->viewable()) { } I'm nor saying this is a solution, but it it can get you started. -
Proposal of modules bzw. Vorschlag von Modulen
Martijn Geerts replied to csaeum's topic in Getting Started
Ganz toll.... Gut gemacht mr-fan. -
Gallery "Deleting" images from multi upload
Martijn Geerts replied to louisstephens's topic in API & Templates
Images are stored as soon as they are on disk so it depends on upload speed. Not much you can do about it. -
Can't get PW to output German month names
Martijn Geerts replied to totoff's topic in General Support
I think it is possible to change the language of the datepicker with javascript: http://jsfiddle.net/repw4/418/ -
Can't get PW to output German month names
Martijn Geerts replied to totoff's topic in General Support
I don't get what you're askin'.