-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
Inconsistent behavior of LanguageSupportPageNames and UI
Soma replied to Zeka's topic in Multi-Language Support
For me the first code works perfectly also for alternative languages, but only if you're viewing the correct language ofc. The second example one doesn't work for alternative language with names that are "empty" in DB. -
It's not the Browser cache or something, but the PW page cache in memory. You'd need to reload the $user after your upload and saving image... $u = $users->get($user->id); if($u->profile_picture) { $userImg = $u->profile_picture; echo '<img src="'.$userImg->url.'">'; } Anyway I would recommend to redirect to the page after submit, but then you need to handle errors differently. Like this you would upload the form with a refresh or going back. Also I would rethink the upload folder to be in a folder not accessible from public for security reasons. You can simply use a folder in "site/assets/cache/.uploads" as . folders will get blocked by PW .htaccess. Also you could move the part with the WireUpload into your if($input->post->form_submit) { .... as it's not needed before that.
- 24 replies
-
- 3
-
- image fields
- image upload
-
(and 1 more)
Tagged with:
-
It's ?u= not ?url=
-
Thanks for the link. I looked at it and it's clear why it's not working. You're not only sharing the url but a lot more like title and text. Have you modified the config for Facebook? This is the share link: https://www.facebook.com/sharer/sharer.php?url=https%3A%2F%2Fwww.playwood.it%3A443%2Fplaywood%2Fen%2Fblog%2Fitaly-is-a-door-the-design-is-the-key-4-9th-april-fuorisalone-zona-lambrate-milano%2F&title=Italy is a door. The design is the key | 4-9th April%2C Fuorisalone – Zona Lambrate%2C Milano&text=PlayWood will be present at Fuorisalone 2017%2C presenting an innovative product that allows you to join different panels of any material to create furniture and modular structures. The PlayWood connector has been thought for temporary spaces%2C… Facebook only allows for an url. Facebook then parses the url and gets the content from your og tags on the page.
-
Yeah nice they works so well. But doesn't help why yours isn't.... So do you have a link to yours or not? Otherwise I can't try to help.
-
I'm not sure, but this has always been like this not something new. However, maybe you have an example of that so we can take a look at? Also maybe this is of interest: https://developers.facebook.com/tools/debug/
-
Ask Facebook. As far as I understand it, it's because FB caches the data and on first call it sometimes doesn't show in the dialog (but when posted or shared again the same url).
-
1. There's a example in the code itself with email: if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } Anything the API provides is possible. I can't go into details as there's too much and don't have any examples ready. 2. Of course an array is possible, input->post is also and array. You just have to make it a WireInputData array. https://github.com/processwire/processwire/blob/341342dc5b1c58012ae7cb26cffe2c57cd915552/wire/core/WireInputData.php 3. "Validation" is per Inputfield and it depends. Some inputfields do some sanitations to make sure an expected format or type of value is given (for example email https://github.com/processwire/processwire/blob/341342dc5b1c58012ae7cb26cffe2c57cd915552/wire/modules/Inputfield/InputfieldEmail.module) but most do nothing at all. You can look at all the Inputfields processInput() method to see what it does. Text and Textarea have some Inputfield settings to strip tags for example. It depends also on what the Form is used for and where you use the data afterwards. It's never an issue to save data to DB ie Pages, it's always about what and where you output the data (website, email, ...).
-
I found by accident, trying to find out why my Chrome does this, that the Chrome "use Hardware acceleration if possible" enabled in settings is the Problem. It seems to have problems then rendering the CSS filter used there.
-
It depends on your image field. If it's multiple you need to select one first. ie $page->images->first->httpUrl():
-
"media" can (as any) or must be set by the options array you give the render() method. $options = array( "media" => $page->image->httpUrl() ); echo $modules->MarkupSociaShareButtons->render($options);
-
It's vanilla install. Yes there seems to be some css filter that breaks the rendering/layout.
-
Yes, even if I install a new version. It's a Chrome "bug" most likely.
-
Yeah same version Chrome on OSX. Can nobody see this is broken?
-
Yeah new master! (Upgrading from my local install doesn't work anymore) Installs manually... opens ProcessWire backend. Editing Page, images in grid view in Chrome is broken (seems to be ok in FF). Well done and tested!
-
Nope, a name wouldn't be unique throughout the system. I don't see a problem at all to see the page ID.
-
Oh, it's a theme issue? Sorry, never used other AdminTheme.
-
-
I meant there is in the example if you remove the <ul> from the options, it would results in <ul><div><li>...</li></div></ul>, not saying bootstrap has. I tried with a special hook to remove the <li>' on the level greater than 1. Does that work for you? $nav = $modules->get('MarkupSimpleNavigation'); $options = array( 'has_children_class' => 'dropdown', 'list_tpl' => '<li%s>||</li>', 'current_class' => 'active', 'list_field_class' => 'nav-item', 'max_levels' => 2, 'item_tpl' => '<a class="nav-link gek-anim" href="{url}">{title}</a>', 'outer_tpl' => '<ul class="navbar-nav ml-auto">||</ul>', 'inner_tpl' => '<div class="dropdown-menu">||</div>', 'item_current_tpl' => '<a class="nav-link active" href="{url}">{title}</a>', ); $nav->addHookBefore("getListString", null, function($event){ $msn = $event->object; if($msn->iteration > 1){ // on level 2 and greater $msn->list_tpl = array("",""); } else { $msn->list_tpl = array("<li%s>","</li>"); } }); $sidebar .= $nav->render($options);
-
You don't want to remove the || placeholder used to render the entries. Edit: Ah I see, there's a problem of <li>'s inside a <div> within a UL isn't valid HTML and Browsers moves them out of the <div>. Unfortunately there's not way to render such a thing in MSN. Bootstrap is really strange... why can't they just have normal nested UL's...
-
Maybe remove the <ul></ul> from your options "inner_tpl" code then?
-
Is there a way to combine hooks to reduce the code
Soma replied to Juergen's topic in API & Templates
I wonder why you need something like this in the first place "to have at least one date". wire()->addHookBefore('Pages::trash', null, 'hookTrashDelete'); wire()->addHookBefore('Pages::delete', null, 'hookTrashDelete'); function hookTrashDelete($event) { $page = $event->arguments("page"); //prevent deletion of last child $preventTpls = [ 'single-date', 'single-event', 'single-business-vacation', 'single-special-business-hours' ]; if(in_array($page->template, $preventTpls)) { preventDeleteDateEntry($event, $page); } } function preventDeleteDateEntry($event, $page){ if($page->parent->numChildren() === 1) { $event->replace = true; // now original function won't be called wire()->warning(__("Deleting of the last date is not allowed. There must be at least 1 date.")); } else { wire()->message(__("1 date was deleted.")); } } I would code it like this. So the hook could be used for different things. Also some code formatting for better reading. Use $page->numChildren(), in case you have thousands/millions of children you'd get a server out of memory Don't use $event->return = error. -
https://processwire.com/api/ref/input/page-num/
-
Pagetable field stripping off decimals when using german language?
Soma replied to bernhard's topic in General Support
What's the difference? Pagetable are pages that are edited in the modal. Your screenshot in OP doesn't show a pagetable btw.