-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Sorry to hear that. Could you please provide some additional information (pw version, 3rd party modules, serverside software), as I'm not aware of any other recent issue report like yours.
-
I think you're looking for these: http://processwire.com/api/variables/sanitizer/ There are also some more then in the docs: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Sanitizer.php#L684
-
The images are created as soon as the api is called, so you could just build a module, which created the thumb for each page. Could for example be a pageaction, which are currently mostly used for listerpro.
-
ProcessWire Module Generator
LostKobrakai replied to Nico Knoll's topic in Module/Plugin Development
Fieldtype + Inputfield is also kinda common. -
How To Create An "Action" In An Admin Page
LostKobrakai replied to Gazley's topic in General Support
You don't want to save the page, as the hook, which runs the added action is executed before changes are evaluated. If you need the latest information you need to change the hook: $this->addHookBefore('ProcessPageEdit::processInput', $this, 'addButtonsMethods'); // to $this->addHookAfter('ProcessPageEdit::processInput', $this, 'addButtonsMethods'); As for your plain link: Where exactly do you have problems? Most likely it will be kinda similar to my code, but you'd use InputfieldMarkup to add custom markup instead of a button. -
Using "show this field only if", no values are stored!
LostKobrakai replied to horst's topic in General Support
-
Using "show this field only if", no values are stored!
LostKobrakai replied to horst's topic in General Support
Just to clarify, are the fields you're talking about hidden on saving the page or does this even happen if they are visible? Latter one can hardly be intentional. -
Tip request: same page, two links, two templates
LostKobrakai replied to heldercervantes's topic in General Support
Regarding Problem #2: I think the best way would be to store product information in a separate part of the tree, without frontend access and then use the data from there in all the places you need them. For both problems I'd suggest you should take a look at urlSegments. -
This behavior is normally the reason to go for language alternate fields. But you can still get the field as normal by calling file_en or even not using language alternate fields. Either way you would need to build the logic to select the appropriate field on your own.
-
It does not save the real value of the field, but only the textual representation. That's why it's not like version control.
-
Creating permission based access to field languages
LostKobrakai replied to alexcapes's topic in Multi-Language Support
LanguageSupport::hookInputfieldAfterRender is probably the place you're looking for, but it's currently not hookable, so that you can't change anything to it from the outside. The not so updates friendly alternative would be, that you copy the module to the site/modules/ directory to use your own altered version of it, which is possible with the the dev branch. -
How To Create An "Action" In An Admin Page
LostKobrakai replied to Gazley's topic in General Support
You could just alter this to your needs. This adds a second button to the pageEdit, which then triggers an action if clicked. <?php class HookPageEdit extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hook PageEdit', 'version' => 1, 'summary' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); $this->addHookBefore('ProcessPageEdit::processInput', $this, 'addButtonsMethods'); } /** * Add a button besides "Save", which lets the user accept the application * */ public function addButtons($event) { $page = $event->object->getPage(); if($page->template == "application"){ $form = $event->return; $accept = $this->modules->get('InputfieldSubmit'); $accept->attr('id+name', 'hook_accept_application'); $accept->class .= ' ui-priority-secondary head_button_clone'; $accept->attr('value', $this->_('Accept Application')); $form->insertBefore($accept, $form->get("id")); } } /** * Triggers the pageAction of "PageActionAcceptApplication" if the page was * submitted via the added button. This won't save the page, because that only * happens if the button is named "submit_save" or "submit_published" * */ public function addButtonsMethods($event) { if($this->input->post->hook_accept_application){ $page = $event->object->getPage(); $event->replace = true; if(!$page->id){ $this->error("Invalid application to be accepted."); return; } $accept = $this->modules->get("PageActionAcceptApplication"); $accept->action($page); } } } -
You can use the imagesizer class without the image being part of a field. I'll add a script I use for creating thumbs of form builder entry images. protected function getThumb($file, $formID, $entryID){ $path = $this->forms->get($formID)->entries()->getFilesPath($entryID); $fileParts = explode(".", basename($file)); $ext = end($fileParts); // Create thumbnail $basename = basename($file, "." . $ext); $basename .= '.0x150.' . $ext; $filename = $path . $basename; $exists = file_exists($filename); if(!$exists && @copy($file, $filename)) { try { $sizer = new ImageSizer($filename); $sizer->setOptions(array( 'upscaling' => false, 'cropping' => false, 'quality' => 90, 'forceNew' => false, )); if($sizer->resize(0, 150)) { if($this->config->chmodFile) chmod($filename, octdec($this->config->chmodFile)); } else { $this->error = "ImageSizer::resize(0, 150) failed for $filename"; } } catch(Exception $e) { $this->error = $e->getMessage(); } } if(file_exists($filename)) return $this->forms->getFileURL($formID, $entryID, $filename); else return null; }
-
Building the Chrome App is one part, but building the logic for syncing back changes is certainly a whole lot of another topic. I don't want to discourage you, but my suggestion would be: Some Folders and textfiles, maybe you could a an importer for those files, to save the copy/pasting.
-
You should best put this not in a php shortcode and not in a attribute. This way you'll just see the text in your website. <pre><?php var_dump($logo->description); ?></pre><img… /> But the information is still there. It's an empty string ( string(0) ) as long as you're not logged-in, which is quite strange. Could you please post which version of ProcessWire you're using and if there are any 3rd party modules installed? Then nothing would be outputted and not only the description missing.
-
Please have a look a the actual source-code and not the dom representation of the devtools. They sometimes hide things all together if there's a issue with parsing. The "include=hidden" selector shouldn't matter, as it's only part of getting the page. If your image is shown, then your selector is working. With you stating that it works for logged-in users, could you please post what this shows you if you're not logged in? var_dump($logo->description); Also please make sure $config->debug is enabled, so errors are shown.
-
Just read the latest post and I have never used the module by myself, so I couldn't be sure.
-
Single image upload on frontend doesnt work correctly
LostKobrakai replied to Juergen's topic in API & Templates
From the api side image fields are always multi-value. Only the "output-formatting" state does allow you to call the first image automatically. Therefore you need to clear the image field manually before adding the new image. -
A shot in the dark: Probably this form is not generated by Fredi, but it just reuses ProcessPageEdit. Therefore you'd need to have a look at this, there are already some topics here about removing the settings/delete tabs there.
-
get field value from non-default language, $page->title
LostKobrakai replied to palacios000's topic in Multi-Language Support
http://processwire.com/api/multi-language-support/multi-language-fields/#multi-language-field-values -
I don't know what you're exact problem is, but there's a single quote missing.
- 10 replies
-
- css
- image field
-
(and 1 more)
Tagged with:
-
Damn that looks really slick.
-
$image->size() misses height argument inside a function
LostKobrakai replied to totoff's topic in API & Templates
You're invoking the function with a single argument of the type "string" and the value "690,425", but size() needs two arguments/values, best of the type int. You cannot fake the comma between function arguments. list($w, $h) = explode(",", $size, 2); $w = (int) $w; $h = (int) $h; $slideimage = $slideimage->size($w, $h);- 1 reply
-
- 2
-
Another guy in trouble with search pagination
LostKobrakai replied to heldercervantes's topic in General Support
Not not as hard as one would think. Storing simple strings is really easy, see here: https://processwire.com/api/variables/session/.