Jump to content

kalimati

Members
  • Posts

    32
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

1,016 profile views

kalimati's Achievements

Jr. Member

Jr. Member (3/6)

7

Reputation

  1. Finally I was able to solve it. dump command helped to nail the problem at each stage. $classroom = $page->trgMode->find("title=In Classroom"); $online = $page->trgMode->find("title=Live Online Training"); $onsite = $page->trgMode->find("title=Onsite Training"); if (((count($classroom) == 0) && (count($online) == 0)) && (count($onsite) > 0)) { echo "<p>This course is available only as an Onsite program.</p>"; }
  2. I have a template for courses for a website on training. Within the template I use a multiselect page reference field to define attributes associated with the course. While rendering the page I want search for a combination of attributes -in the multiselect page reference field - presence and absence of some of them -- and perform an operation accordingly. How do I search for a combination of values in the multiselect page reference field? Thanks. Here is the pseudo code: if ($page->pageReferenceField->has("title=one|two") && $page->pageReferenceField->doesnothave("title=three")) { echo ...; }
  3. This works on the first level of dropdowns but not with the second levels. In fact, even a click does not open level two of dropdowns. Any ideas what can be done. Thanks.
  4. Thanks for your prompt response. Nothing urgent. Will try and figure it out.
  5. Hi bernhard, Can you provide a sample code for multiple forms on one page with independent error reporting and success messaging? Thanks
  6. The site is structured this way: mag-issue1 - article1 - article2 - article3 ... mag-issue2 - article1 - article2 - article3 ... mag-issue3 - article1 - article2 - article3 ... ... The idea is to select the children of the latest mag-issue as the selectable pages for the page reference field.
  7. I want the list to consist of articles (children) in the latest issue of a magazine (parent). But it matches 0 pages!
  8. 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.
  9. It is a namespace issue. Changed the reference to makeUIkit to: $form->onRender[] = 'processwire/makeUIkit';
  10. 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>
  11. 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.
  12. AllInOneMinify ProcessWireUpgrade Duplicator E-mail Obfuscation Repeater (core)
  13. 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/
×
×
  • Create New...