-
Posts
516 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Gideon So
-
Hi, I have a image field which set limit to 1 and it works fine until I upgrade the core to 3.0.137. Everytime I try to upload a image to the field, it causes the following error: Recoverable Fatal Error: Argument 1 passed to ProcessWire\Pageimage::setOriginal() must be an instance of ProcessWire\Pageimage, null given, called in /home/web/processwire/WireCore-3.0/core/PageimageVariations.php on line 257 and defined (line 1334 of /home/web/processwire/WireCore-3.0/core/Pageimage.php) When I reload the page and try to edit the page, the backend looks like the following screenshot. The old image is not deleted. And I found that the image record still exists in the database. Any clue is welcome. Gideon
-
How to get a File Download link in a Page : PDF file attached
Gideon So replied to JeevanisM's topic in API & Templates
Hi @JeevanisM, Let me see. You should have code like this: <a href="<?php echo $page->pagefile->httpUrl; ?>">Click here to download</a> The code above should output a link to download the file. Gideon -
Hi @iNoize, Go check your FB app settings and remove all unnecssary permission. Gideon
-
How to get a File Download link in a Page : PDF file attached
Gideon So replied to JeevanisM's topic in API & Templates
Hi @JeevanisM, Try this: echo $page->pagefile->httpUrl; $page: the current page pagefile: the page file field httpUrl: the full url of the pagefile The whole statement means echo the full url of the pagefile in current page. Hope this helps. Gideon -
WOW. This is very impressive. Gideon
-
Imho, This functionality really should be in the core Gideon
- 10 replies
-
- 8
-
-
-
- install
- class name
-
(and 3 more)
Tagged with:
-
Hi @Vaei, Oh. Yeah. I was on the bus when typing. Glad that you make it right yourself. Gideon
-
Hi @Vaei, You can do this by adding a css style to the head bar. HTML <header class="fixed-top"> Your menu here </header> CSS .fixed-top { position: fixed; top: 0; } Gideon
-
about sitemap and google webmaster
Gideon So replied to franciccio-ITALIANO's topic in Getting Started
Yes. All in one SEO solution. Gideon -
Hi @Salah-eddine Etangi, Welcome to the forum. Can you show us any error you saw when you access the backend (admin space)? Gideon
-
about sitemap and google webmaster
Gideon So replied to franciccio-ITALIANO's topic in Getting Started
Hi @franciccio-ITALIANO, Try this great module. http://modules.processwire.com/modules/markup-sitemap/ Gideon P.S. Oops. 1 minute late.... -
Hi, I have a strange problem as below: Linux box Chrome always serves jpg files instead of webp files but Firefox does serves the webp files. Mac Bookpro Both Chrome and FireFox serve jpg files only. Any clues?? Gideon P.S. Solved. Seems like it is a browser cache problem.
-
Hi @Jim Bailie, You can use a page reference field. Gideon
-
Hi @stanoliver, Try if($page->path == "/categories/cars/") { Do your thing here. } Gideon
-
How add pw-text/body and pw-image in a template
Gideon So replied to franciccio-ITALIANO's topic in Getting Started
Hi @franciccio-ITALIANO, Welcome to the forum. If you want to show a image from a image field that set limit to 1 image per field, please try <img style="float:right;" class="attention-img-popup" src="<?php echo $page->images; ?>" alt=""> You can read more imfo about image field here: https://processwire.com/docs/fields/images/ Gideon -
In case someone need the solution: wire()->addHookBefore('Pages::saveReady', function ($event) { $page = $event->arguments(0); if(count($page->pageBanner)){ $page->of(false); $page->pageBanner->first()->focus([top],[left]); $page->of(true); } }); Gideon
-
I see. Learn a lesson. Thanks @Robin S Gideon
-
Is it possible to set page image focus through a hook?? I tried this piece of code but it seems doesn't work. wire()->addHookAfter('Pages::saveReady', function ($event) { $page = $event->arguments(0); if(count($page->pageBanner)){ $page->of(false); $page->pageBanner->focus(10,10); $page->save(); $page->of(true); } }); Processwire throw this error: Any ideas is much welcome. Gideon
-
Get random items from repeater field from specific pages
Gideon So replied to Tyssen's topic in API & Templates
I got your idea wrong. Let me see.... $randomPages = $pages->find("your selector here")->shuffle(); foreach($randomPages as $randomPage): foreach($randomPage->repeater_field->findRandom(3) as $item) : Output endforeach; endforeach; Use findRandom() instead of getRandom(). -
Get random items from repeater field from specific pages
Gideon So replied to Tyssen's topic in API & Templates
Please try $randomPage = $pages->find("id=1049|1053|1055|1059|1152")->findRandom(1); Don't use get. Gideon -
Get random items from repeater field from specific pages
Gideon So replied to Tyssen's topic in API & Templates
Hi @Tyssen. for($i = 0; $i < 5; $i++): $randomPage = $pages->find("your selector here")->findRandom(1); foreach($randomPage->repeater_field->getRandom(3) as $item) : Output endforeach; endfor; Hope this helps. -
Hi @gregory, Can you tell me more about your template settings?? Are you using the pro module: repeater matrix?? https://processwire.com/store/pro-fields/repeater-matrix/ Gideon
-
Hi @gregory, Is "case_studies" is a repeater or repeater matrix field?? Gideon
-
Hi @gregory, What is the field type of "type"?? Please provide more info about your template and field settings. Gideon
-
Formatting page array items - first, second, or third items
Gideon So replied to hollyvalero's topic in General Support
Hi @hollyvalero, Maybe you can try $yourArray->eq() to get the item you want. Can't give long example. Please take a look on the doc here: https://processwire.com/api/ref/wire-array/eq/ Gideon