-
Posts
2,321 -
Joined
-
Last visited
-
Days Won
44
Everything posted by tpr
-
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
PM sent. -
No, there is only one field per image: foreach($page->images as $image) { echo '<img src="' . $image->width(200,0)->url . '">'; echo '<p>' . $image->description . '</p>'; }
-
$image->description But since you wrote 2 text fields, not one, it's not really an alternative. And the description field is for... well, for image description I would use Image Extra, or the other profields mentioned above. http://modules.processwire.com/modules/image-extra/
-
You can use module Image Extra or the pro field Matrix Repeater or Table field. Or page table, but that's not so comfortable.
-
Brain fart? Get the strings before the loop and there you go $text1 = $page->text1; Or are these texts not on the same page? F***, didn't know adrian was also online
-
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
Maybe you should wait for my Nette forms module indeed. Seem like I don't manage to hide it forever It's functional and I use it on many production site but given the complexity of forms it's still only in alpha state. It's more about how I solved integrating Nette forms into PW, but still, there are areas I haven't explored. -
Checking for multiple page ids if statement not working.
tpr replied to bowenac's topic in General Support
IF logic, though seems simple, can be quite complex sometimes (or is it just me?) You could perhaps use !in_array(...) here, easier to read and grasp. -
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
I haven't gone that far and I really hope I never need to -
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
Well you can dynamically build your form too, eg. if($user->hasRole('role_name')) { $form->addTextarea('result_to_see', _t('What is the result you would like to see?', 'Form'), 50, 3) ->setRequired(_t('Required field', 'Form')) ->setOption('character-counter', array('mode' => 'down', 'msg' => _t('%d characters left', 'Form'))) ->setAttribute('data-autosize') ->setAttribute('maxlength', 500); } $preferences = array( 'trial' => 'I would prefer to start with a small trial project to see how we can work together.', 'resolve' => 'I have a specific inquiry, and just want this issue to get resolved.', 'best-roi' => 'I want to go big. Let’s see how we can achieve the best return on investment overall.' ); if($something) { $preferences['anotherItem'] = 'Anther radio button'; } $form->addRadioList('preferences', _t('Please set the preference that best suits you', 'Form'), $preferences) ->setRequired(_t('Required field', 'Form')); echo $form; But you see what fits better for your project. -
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
I do not use PW's form markup at all but Nette Form elements. Renderer is easy to customize, eg. $required_asterix = Html::el('sup')->setClass('asterix')->setText('*'); $colon = Html::el('span')->setClass('colon')->setText(':'); $renderer->wrappers['form']['container'] = 'div class="form-wrapper"'; $renderer->wrappers['controls']['container'] = 'div'; $renderer->wrappers['control']['container'] = 'div'; $renderer->wrappers['control']['description'] = 'p class="form-description"'; $renderer->wrappers['error']['container'] = 'ul class="help-block text-danger form-error"'; $renderer->wrappers['label']['suffix'] = $colon; $renderer->wrappers['label']['requiredsuffix'] = $required_asterix; As I wrote modifying the markup this way is well enough for simpler forms, and even for larger forms if there are no fancy things. Here is a quick screencap where I used manual rendering, which allows custom markup. Form fields are defined separately, and you can retrieve the full control, or only the label or control, error parts, etc. I like the freedom it gives. <div class="form-wrapper" n:if="$rsvpForm"> <fieldset> <legend><span><strong>Personal data</strong></span></legend> <p class="checkbox-wrap"> {$rsvpForm[participation_toggle]->getControlPart()} <label for="cf_participation_toggle">We attend the wedding</label> <span class="slideToggle">{$rsvpForm[participation_toggle]->getLabelPart()}<strong></strong></span> <label for="cf_participation_toggle">Unfotunately we cannot attend the wedding</label> </p> <div id="personal_data"> <div> <div class="input-wrap">{$rsvpForm['name']->control->cols(35)} {$rsvpForm['name']->error}</div> <div class="input-wrap">{$rsvpForm['email']->control->cols(35)} {$rsvpForm['email']->error}</div> <div class="input-wrap">{$rsvpForm['phone']->control->cols(35)} {$rsvpForm['phone']->error}</div> </div> </div> </fieldset> ... -
Anyone done Ajax login with bootstrap.io form validation?
tpr replied to Juergen's topic in General Support
So true! The default renderer is enough 99% of the time but there is the manual rendering where you can build the markup as you like it. I've done in a recent project and it's really awesome. Will post a screenshot later. Do you use the default validation Js or live-form-validation.js? I use the latter, the fork by Robyer, I found this to be the best maintained: https://github.com/Robyer/nette-live-form-validation -
@Bill C, getting familiar with Tracy would have taken less time than writing your post
-
Using translatable strings across template files
tpr replied to Webrocker's topic in Multi-Language Support
I see, thanks. I will think about it if it's a good practice, I use the same thing in my Latte module. -
Using translatable strings across template files
tpr replied to Webrocker's topic in Multi-Language Support
You can use a page dedicated to translations. Just create multilanguage text or textarea fields and simply echo their content as usual. -
Glad you figured it out! It's interesting why it doesn't work without the context for you. Are you sure you haven't messed up the underscores? There is one in latte files, and two in _strings.php. But I guess you checked that enough times Getting string translation to work is a bit tedious at first, but once you get the hang of it it's easy. Using plurals adds another layer of complexity, even if I tried hard to make it as simple as I can
-
This is probably an overkill, but it would be nice if drag-and-drop an image from an image field to CKEditor could work, even if showing a popup first.
-
You don't need to set any variable for translation. If you need to translate string in the controller, use "_t('Text to translate'). In .latte file you can use '_', '_t'. I tried to replicate your issue, here are the steps (tried on 3.015 and 3.017 also): 1. Added "<p>{_'Text to translate'}</p>" into "home.latte" (one underscore). Text appearead in my home page fine, untranslated. 2. Added this to "_strings.php" - mind the double underscore here: __('Text to translate') 3. In the admin language editor I added the corresponding translation. Prevously I have selected the file "_strings.php" to translate. etalsnart ot txeT After that, this translated text appeared on the page. Even for the default language when setting it another value in the Language Translator.My further bugsolving thoughts are: are you sure the same string is in _strings.php and your .latte file? try clearing Latte cache in module settings Btw, just realized that _strings.php doesn't need starting php tag and comments but only listing the translations (without semicolon at the end).
-
Why is that site a failure? It looks nice and seem to work fine. I've used fullPage.js on this site which is similar to NIceScroll. On such sites the frontend (js/css) is much harder than the backend (php).
-
When the user scrolls down to an element, JavaScript updates the element's inline style, eg "left: 120px". If you scroll more, it will be 150px, for example, so it "moves", depending on the scroll offset. But it can depend on other element's position too, and you can update other CSS property also, eg opacity, to stimulate fade in or fadeout. The scroll event is fired multiple times on each scroll and Js needs to recalculate everything plus updates the DOM, which needs a lot of resources.
-
Check ScrollMagic, for example: http://scrollmagic.io/ Items' vertical position are constantly watched and animations kick in when a certain value is reached. So it's entirely a frontend task, plus it's a plus if you can think in animations. The glasses is put together from two parts, I guess
-
Another notice, hopefully more to the point When "Loggin in production mode" is on, Google PageSpeed (and others) report much worse speed scores. I get about 85 vs 95 on the site I'm currently working. This is logical but maybe this could be noted somewhere.
-
False alarm: I had version 1.3.8. After update it's all fine. For me showing these checked on Selector Panel is no problem. Though you could solve it by CSS, the admin has "template-admin" class on the body, e.g. hide it.
-
Just saw that the Validator panel is also loaded in the admin, perhaps it's not really needed there.
-
Yes, such sites look/feel nice, provided you have a capable internet connection and a fast computer. Otoh they are usually a nightmare from usability point of view not to mention the complexity the developer faces I sometimes add a small parallax but even the smallest one requires much extra work. Recently I saw this site that catched my eyes: http://moto.oakley.com/ Ps. it's heavily animated!
-
I was just trying to be funny here that's why the smiley. But it's true that it's often hard to put things right, especially because a wrong wording or term can easily modify the meaning. Otoh you "natives" seem to have a good sense for understanding malformed posts