Jump to content

kalimati

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by kalimati

  1. Hi, For a Page Reference Field I would like to use filter something like this: parent=$pages->findOne("template=mag-issue, sort=-created") But I am not able to get it to work using the various options available to define selectable pages. Any idea where I could be going wrong or how to approach it. Thanks.
  2. It is a namespace issue. Changed the reference to makeUIkit to: $form->onRender[] = 'processwire/makeUIkit';
  3. HI Bernhard, Thanks for the module. Looks interesting and worth exploring. I am trying it out but running into a problem while using a rendering function for UIkit, adapted from the makeBootstrap4 one used on the Nette site as an example. I get the error: Call to undefined function makeUIkit(). Any idea where I may be going wrong. Thanks. namespace ProcessWire; use Nette\Forms\Form; function makeUIkit(Form $form): void { $renderer = $form->getRenderer(); $renderer->wrappers['controls']['container'] = null; $renderer->wrappers['pair']['container'] = 'div class="uk-margin"'; $renderer->wrappers['pair']['.error'] = 'uk-form-danger'; $renderer->wrappers['control']['container'] = 'div class="uk-width-2-3@s uk-form-controls"'; $renderer->wrappers['label']['container'] = 'div class="uk-width-1-3@s uk-form-label"'; $renderer->wrappers['control']['description'] = 'span class="form-text"'; // non uikit $renderer->wrappers['control']['errorcontainer'] = 'span class="form-control-feedback"'; // non uikit $renderer->wrappers['control']['.error'] = 'is-invalid'; // non uikit foreach ($form->getControls() as $control) { $type = $control->getOption('type'); if ($type === 'button') { $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'uk-button uk-button-primary' : 'uk-button uk-button-secondary'); $usedPrimary = true; } elseif ($type === 'text') { $control->getControlPrototype()->addClass('uk-input'); } elseif ($type === 'textarea') { $control->getControlPrototype()->addClass('uk-textarea'); } elseif ($type === 'select') { $control->getControlPrototype()->addClass('uk-select'); } elseif ($type === 'file') { $control->getControlPrototype()->addClass('uk-input'); } elseif (in_array($type, ['checkbox', 'radio'], true)) { if ($control instanceof Nette\Forms\Controls\Checkbox) { $control->getLabelPrototype()->addClass('uk-checkbox'); } else { $control->getItemLabelPrototype()->addClass('uk-radio'); } $control->getControlPrototype()->addClass('form-check-input'); $control->getSeparatorPrototype()->setName('div')->addClass('form-check'); } } } $states = [ 'Andaman & Nicobar Islands' => 'Andaman & Nicobar Islands', 'Andhra Pradesh' => 'Andhra Pradesh', 'Arunachal Pradesh' => 'Arunachal Pradesh', 'Assam' => 'Assam', 'Bihar' => 'Bihar', 'Chandigarh' => 'Chandigarh', 'Chhattisgarh' => 'Chhattisgarh', 'Dadra-Nagar Haveli & Daman-Diu' => 'Dadra-Nagar Haveli & Daman-Diu', 'Delhi' => 'Delhi', 'Goa' => 'Goa', 'Gujarat' => 'Gujarat', 'Haryana' => 'Haryana', 'Himachal Pradesh' => 'Himachal Pradesh', 'Jammu and Kashmir' => 'Jammu and Kashmir', 'Jharkhand' => 'Jharkhand', 'Karnataka' => 'Karnataka', 'Kerala' => 'Kerala', 'Ladakh' => 'Ladakh', 'Lakshadweep' => 'Lakshadweep', 'Madhya Pradesh' => 'Madhya Pradesh', 'Maharashtra' => 'Maharashtra', 'Manipur' => 'Manipur', 'Meghalaya' => 'Meghalaya', 'Mizoram' => 'Mizoram', 'Nagaland' => 'Nagaland', 'Odisha' => 'Odisha', 'Puducherry' => 'Puducherry', 'Punjab' => 'Punjab', 'Rajasthan' => 'Rajasthan', 'Sikkim' => 'Sikkim', 'Tamil Nadu' => 'Tamil Nadu', 'Telangana' => 'Telangana', 'Tripura' => 'Tripura', 'Uttar Pradesh' => 'Uttar Pradesh', 'Uttarakhand' => 'Uttarakhand', 'West Bengal' => 'West Bengal' ]; $form = new Form; $form->onRender[] = 'makeUIkit'; $form->addText('name', 'Name:') ->setRequired('Please fill your %label.'); $form->addEmail('email', 'Email:') ->setRequired('Please fill your %label.'); $form->addText('designation', 'Designation:') ->setRequired() ->setHtmlAttribute('class', 'uk-width-1-2@s'); $form->addText('company', 'Company:') ->setRequired() ->setHtmlAttribute('class', 'uk-width-1-2@s'); $form->addCheckbox('printed', 'Please send me the printed edition. Delivered within India only.'); $form->addText('address', 'Address:') ->setHtmlAttribute('class', 'uk-width-1-2@s') ->addConditionOn($form['printed'], $form::EQUAL, true); $form->addText('city', 'City:') ->setHtmlAttribute('class', 'uk-width-1-2@s') ->addConditionOn($form['printed'], $form::EQUAL, true); $form->addSelect('state', 'State:', $states) ->setHtmlAttribute('class', 'uk-width-1-2@s') ->addConditionOn($form['printed'], $form::EQUAL, true); $form->addInteger('pin', 'PIN:') ->setHtmlAttribute('class', 'uk-width-1-2@s') ->addConditionOn($form['printed'], $form::EQUAL, true) ->addRule($form::PATTERN, 'Please enter a valid Indian PIN code', '^[1-9]{1}[0-9]{5}$'); $form->addSubmit('subscribe', 'Subscribe'); ?> <script pw-append="html-head" src="https://nette.github.io/resources/js/3/netteForms.min.js"></script> <div id='content' class='uk-width-expand'> <div class="uk-child-width-1-2@m" uk-grid> <div> <?php $latest_mag = $pages->get("template=mag-issue, sort=-created"); echo "<img class='uk-align-center' src='{$latest_mag->images->first->url}' alt='{$latest_mag->title}' />"; ?> </div> <div> <h2>Subscribe!</h2> <?php $form->render() ?> </div> </div> </div>
  4. I have imported a table of articles and a table of authors. They are both connected via author_id field. How do I convert this link to Processwire native page reference field? Thanks.
  5. AllInOneMinify ProcessWireUpgrade Duplicator E-mail Obfuscation Repeater (core)
  6. Great tutorial. I had implemented something like this in 2018 using Hanna Code. I my case the website has a seperate gallery section and the relevant galleries are imported wherever needed at appropriate positions in articles. Example page: https://ashajsr.org/updates/udaan-girl-child-day-2019/
  7. It may have something to do with the graphics conversion engine installed. I corrected the problem on my local server by installing ImageMagick.
  8. What about PNG images with transparency? The transparent areas are appearing as black in the webp images. Any special settings for those?
  9. Thanks dragan. That must have been it. The cleaned code worked.
  10. <?php /** * Program Listings * Included in Programs Template */ $out = "<div class='uk-grid-small uk-child-width-1-2@s uk-flex-center' uk-grid>"; foreach($page->children() as $program) { $out .= "<div>"; $out .= "<div class='uk-child-width-1-2@s' uk-grid>"; if (count($program->images)) { $firstImage = $program->images->first(); $firstImage->size(320, 240); $out .= "<div><img src='{$firstImage->url}' alt='{$firstImage->description}'></div>"; // Line 17 } else {  $out .= "<div> </div>"; } $out .= "<div><p>$program->date</p><p>$program->headline</p><p>$program->body</p></div>"; $out .= "</div></div>"; } $out .= "</div>"; echo $out; ?> Can anyone please tell me why do I get syntax error, unexpected '' (T_STRING) on line 17? Thank you.
  11. Thank you Soma. That was quick. You were right I had to install the Package Manager separately. Sorry about posting it here.
  12. I have installed Duplicator and can access it's Settings page. But it does not show up in the following url sitename/processwire/setup/duplicator/ The error message is: ProcessWire: Unrecognized path Any Idea what could be wrong. I am using Processwire version 3.0.107. Thanks.
  13. Thanks Adrian. I went with Option 7. Works well. I guess my mistake was keeping 'multiLine' -> true assuming it to be a pre-condition to paragraph formatting.
  14. That is how I managed. I thought newlineReplacement would do the replacements. It wasn't so as the name of the option suggests. Thanks anyway.
  15. I am using sanitizer->textarea to sanitize and format the message inputted. I've tried various options including newlineReplacement but have been unable to convert newlines to <br> tags. Although the PHP nl2br function works as expected. Any suggestions? Thanks.
  16. Solved it. Had both versions, composer and direct download!!
  17. Compile Error: Cannot declare class Valitron\Validator, because the name is already in use (line 13 of /var/www/mydomain.com/public_html/vendor/vlucas/valitron/src/Valitron/Validator.php) I get the above error. Any idea why that should be happening?
  18. Can't we just use the images field as input for a Page type field? Each image has a description that can be use as a title?
  19. Processwire allows us to define predefined tags for images. What if I want to use a repeater field on the page for the purpose? How can I use values of this repeater field as the list of available tags for image fields? Thanks.
  20. Thank you, gmclelland. That was it besides cleaning the cache.
  21. I have been updating an existing website on my local Ubuntu server. I updated the website from Processwire 2.5 to 2.8.62. No issues till this point. Then I created a new templates folder, installed Foundation 6, copied the old PHP template files and customized the SCSS files to rebuild the site. The frontend works without a problem. However, when I try to access the backend, the website/processwire url, I get this error message. Any idea what is wrong and how can I correct the issue? I made no changes to the backend theme. ======================================== Warning: fopen(/var/www/tribology/public_html/site/assets/logs/exceptions.txt): failed to open stream: Permission denied in /var/www/tribology/public_html/wire/core/FileLog.php on line 82 Fatal error: Exception: Missing or non-readable template file: admin.php (in /var/www/tribology/public_html/wire/modules/PageRender.module line 517) #0 /var/www/tribology/public_html/wire/core/Wire.php(383): PageRender->___renderPage(Object(HookEvent)) #1 /var/www/tribology/public_html/wire/core/WireHooks.php(698): Wire->_callMethod('___renderPage', Array) #2 /var/www/tribology/public_html/wire/core/Wire.php(442): WireHooks->runHooks(Object(PageRender), 'renderPage', Array) #3 /var/www/tribology/public_html/wire/core/WireHooks.php(782): Wire->__call('renderPage', Array) #4 /var/www/tribology/public_html/wire/core/Wire.php(442): WireHooks->runHooks(Object(Page), 'render', Array) #5 /var/www/tribology/public_html/wire/modules/Process/ProcessPageView.module(205): Wire->__call('render', Array) #6 /var/www/tribology/public_html/wire/core/Wire.php(383): ProcessPageView->___execute(true) #7 /var/www/tribology/public_html/wire/core/WireHooks.php(698): Wire->_callMethod('___execute', Array) #8 /var/www/tribology/public_html/wire/ in /var/www/tribology/public_html/index.php on line 64 Warning: fopen(/var/www/tribology/public_html/site/assets/logs/errors.txt): failed to open stream: Permission denied in /var/www/tribology/public_html/wire/core/FileLog.php on line 82 Error: Exception: Missing or non-readable template file: admin.php (in /var/www/tribology/public_html/wire/modules/PageRender.module line 517) #0 /var/www/tribology/public_html/wire/core/Wire.php(383): PageRender->___renderPage(Object(HookEvent)) #1 /var/www/tribology/public_html/wire/core/WireHooks.php(698): Wire->_callMethod('___renderPage', Array) #2 /var/www/tribology/public_html/wire/core/Wire.php(442): WireHooks->runHooks(Object(PageRender), 'renderPage', Array) #3 /var/www/tribology/public_html/wire/core/WireHooks.php(782): Wire->__call('renderPage', Array) #4 /var/www/tribology/public_html/wire/core/Wire.php(442): WireHooks->runHooks(Object(Page), 'render', Array) #5 /var/www/tribology/public_html/wire/modules/Process/ProcessPageView.module(205): Wire->__call('render', Array) #6 /var/www/tribology/public_html/wire/core/Wire.php(383): ProcessPageView->___execute(true) #7 /var/www/tribology/public_html/wire/core/WireHooks.php(698): Wire->_callMethod('___execute', Array) #8 /var/www/tribology/public_html/wire/ This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.
  22. I have been using MapMarker on a client site for long. Recently I updated the website to Processwire 2.7.2. While trying to add a page using a template with FieldTypeMapMarker I noticed the address box has vanished even though the default map shows. Underneath the map I can see "N/A". Any idea how to get back address box.
×
×
  • Create New...