Wanze
PW-Moderators-
Posts
1,116 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Wanze
-
Configurable Process Module (Need walk through)
Wanze replied to renobird's topic in Modules/Plugins
And add the following at the top of your static public function getModuleConfigInputfields(array $data) {: foreach(self::$configDefaults as $key => $value) { if(!isset($data[$key]) || $data[$key]=='') $data[$key] = $value; } Be careful here, only keys that are not set in the $data array should inherit the default value. Otherwise if a config value is empty, you'd overwrite it with the default value all the time, if the default value ist not empty. Suppose a checkbox with possible values 1 and '' default=1 (checked) User opens Module Config and does uncheck the box After reloading, the box would be displayed as checked Setting the default data in the constructor makes sure that you'll have every config key available as property (->key). The workflow here is: Pw creates your module --> calls constructor Pw does set all the stored config values to the module Pw calls init() method As you can see, modified default config values will get overridden in step 2. Default config values that are not yet stored in the database are set by you in the constructor. -
What is the use case for this functionality? I mean if you want to check if it's loaded and then load it, set singular to true. You'll have a singleton as Pw returns the same instance on every $modules::get() call. If you want to check if it's loaded and then NOT load it: Why would you do that?
-
Will "old" admin themes be supported also in future versions? I'm using a customized version of Soma's great teflon 2 admin theme for a project. After upgrading to the newest dev version, I could uninstall the new Admin theme and so far the Teflon seems to work without problems. I love Pw!
-
Sorry, the login page has its own page... I was too quickly! Please change the other value back to '10'. The page we want has pages_id=23. The right Process has ID=10 So this should work: 1) Make a backup of current DB! 2) In table pages: Entry with id=23 must have templates_id=2 3) In table field_process: Add new entry => pages_id=23, data=10
-
Took a quick look at my databases from several Pw installs. 1) Make a backup of current DB! 2) In table pages: Entry with id=2 must have templates_id=2 3) In table field_process: Add new entry => pages_id=2, data=87 Good luck
-
Hi Melissa, $channel = $pages->get("/blog/"); $entries = $channel->children("blog_date>=$startTime, blog_date<$endTime"); // or substitute your own date field If I understand your question right, the problem is that you are searching for blog-posts only for children of the /blog/ page. Try to search side-wide with with your blog template: $entries = $pages->find("template=blog,blog_date>=$startTime,blog_date<$endTime");
-
Thanks Martijn, great to hear! Cheers
-
Nothing simpler than that. You know that every page in Admin is a page under "Admin"? So you can drag the Changelog page from /Admin/Setup/ and drop it below the /Admin/Pages page.. et voila, the page is no longer displayed under "Setup"
-
@Manfred62 You can use php's sprintf function, so you only need one translation string: $translationStr = __("There are currently %d pages cached in %s"); $f->description = sprintf($translationStr, $numberOfPages, $path);
-
@dragan Add 'permission' => 'your-permission' to the array returned by the method getModuleInfo(). After this line: https://github.com/teppokoivula/ProcessChangelog/blob/master/ProcessChangelog.module#L35 Example: If all users who can edit pages should be able to access the module public static function getModuleInfo() { return array( 'title' => __('Changelog'), 'summary' => __('Keep track of changes (edits, removals, additions etc.)'), 'href' => 'http://modules.processwire.com/modules/process-changelog/', 'author' => 'Teppo Koivula', 'version' => 126, 'singular' => true, 'autoload' => false, 'installs' => 'ProcessChangelogHooks', 'permission' => 'page-edit', ); }
-
@JoZ3 Does this happen only in Firefox? Another browser does work? The statistics are loaded with ajax requests, so if nothing shows up, this normally means that there is an error happening on the server side. Can you open you Javascript console, for example the native one in Firefox or the one in Firebug and check if you get any errors reported?
-
Do you need to add functionality anywhere in the core, does the button you press already exist? If so, you want use a hook that is executed when the button is pressed. Otherwise, if you want to add your own custom logic/forms/buttons, you can use a Process Module.
-
Yep it works, just make sure you're not connected to the Wlan when voting
- 191 replies
-
- 2
-
- bitnami
- installation
-
(and 2 more)
Tagged with:
-
Hi BFD Calendar, I also think that rendering an image with CSS "background-image" is not supported in TCPDF. I will change the PDF distribution from TCPDF to mpdf, although I'm not sure if it is possible to specify a background image within a table with mpdf. But maybe you could set it on a div and wrap the div around the table? What should work is output an image with the "img" tag. How should your list look like? Maybe you could output the image inside a <td> ? Next week I'll find some time to include mpdf and maybe spend some more features for this module.
-
Can you post your code that's not working correctly?
-
What are the language settings of ProcessWire? My guess is that maybe the locale is set different from PHP when you execute the Less script inside Pw templates. See : http://www.php.net/manual/en/function.setlocale.php
-
Ipa, catch the Exception and print out the message, for example: try { // Login } catch (WireException $e) { // Print out message of exception echo $e->getMessage(); }
-
Zahari, There was certainly no offense intended, please don't take this personally. WillyC is.... WillyC, take a look at his other posts I personally also think that the new admin theme needs some work, but it's still a work in progress I guess. Unfortunately I've not enough time right now to test everything and help improving. Btw I like your theme and the colors, please keep it up!! Cheers
-
I'm crying
-
Just to be sure: I recently had a problem when using the top-save button. The values weren't saved but the messages appeared... hope it's not a problem of the button. Good luck! Cheers
-
Hi Seb, welcome to the world of the great ProcessWire! I'll try to translate WillyC to English There are two problems: 1) The code is not efficient. Your two nested for-loops load to much unused pages into memory. As you need only the concerts, go directly over the concert template: $concerts = $pages->find('template=concert'); // Maybe sort by date or another field 2) As already mentioned above, 250+ concerts are a lot to show to a user. Try to paginate them. But could be that the page load already decreases a lot if you try number 1) Cheers
-
You're welcome! Yes exactly. It's the same as getting the values from php's $_POST array, but it's a nice "Pw-way" of doing it Plus you get the advantage that if a variable is not set, $input returns null whereas accessing a variable that does not exist in the $_POST array returns a Notice "undefined index".
-
Hi circlet, welcome to ProcessWire! How is your current setup for the users? I Assume you created two different roles to distinguish them and assigned one of them to your users. You can log-in a user with the API: http://processwire.com/api/variables/session/ Short example: /* After the form with username/password was sent... */ // Log in the user $username = $sanitizer->pageName($input->post->username); //Sanitize username $u = $session->login($username, $input->post->password); // Check if a user was returned or null if (!is_null($u)) { // Redirect based on role if ($u->hasRole('role-A')) { $session->redirect($pages->get('/path/to/page/for/role-a/')->url); } } else { // Wrong username or password }
-
Or in a cached template: <?php echo time(); ?> Then reload the page several times - the value should not change because the output is cached
-
Hi evanmcd Template caching does cache the template output (db queries, php processing etc.) This has nothing to do with the headers. Also the caching is disabled if you're logged in, so you could try another browser or log out to check if you see any improvements.