-
Posts
4,088 -
Joined
-
Last visited
-
Days Won
88
Everything posted by horst
-
Yes that was Stollen. And, ähm, this was you? I thought it was the angel.
-
wich PW version are you using?
- 6 replies
-
- out of memory
- memory_limit
-
(and 2 more)
Tagged with:
-
Best way to get random quote displayed on refresh?
horst replied to kathep's topic in Getting Started
@BernhardB: oh thanks! No problem to correct me if I do such nonsense. Ähm, maybe I need a syntax checking here in the forums editor, -
Best way to get random quote displayed on refresh?
horst replied to kathep's topic in Getting Started
Hey, this is a parse error that says there is a sign missing or there is one to much somewhere in your code between line 1 and line 167 in course.php. So, nothing one can say without seeing the code. With wich Editor do you write your code? I would recommend an editor with syntaxHighlighting and syntaxChecking (!!) for PHP. If you don't have any, you can ask here what other users can recommend on free software for your system (Mac?). I have worked many years with Active State Komodo Edit, what is available for Win, Mac and Linux for free. -
Thanks for giving those insights. I have made a note to the additional param for wider aspect ratios, what wouldn't be much work to implement, but will wait if other users request support for weighten with those wider aspect ratios. Thanks for your help with this.
-
Hey @Ledzepman, here is a good reading about how to deal with urlSegments: https://processwire.com/docs/tutorials/how-to-use-url-segments/ And if you not already know it, best search results do you get with google like this: // searches the whole PW site https://www.google.com/search?q=site:processwire.com+urlsegment // only search in forum posts https://www.google.com/search?q=site:processwire.com/talk+urlsegment --- regarding to the check if a county page exists and taking the example from ryans tutorial, you can do it like this: // we are only using 1 URL segment, so send a 404 if there's more than 1 if($input->urlSegment2) throw new Wire404Exception(); // now check if there is no urlSegment1 if($input->urlSegment1 == '') { // display main content ... } else { // get you a PageArray of all county pages using a appropriate selector. This depends on how you have setup things $countyPages = $pages->get("/path/to/countyparentpage/")->children(); // build an array of what you need to validate, titles or names ? (I use their names in the example here) $validCounties = array(); foreach($countyPages as $cp) { $validCounties[$cp->name] = $cp->name; } // now check if it is a valid county if(isset($validCounties[$input->urlSegment1])) { // display county content ... } else { // unknown URL segment, send a 404 throw new Wire404Exception(); } }
-
No, it isn't in like you explained here, but it is somehow in without a double loop. But only when using a square boundary box and when the images are between the ratio aspects 1:2 -> 2:1. Images with more extreme ratio aspects are scaled none linear so that those are displayed smaller. So, the normal usage of weighten works like your description but is assuming the ratio aspect isn't wider than 2:1 / 1:2. When we add an additional param for the widest aspect ratio we should get the same effect as you described, I think. You first have to run a loop through the images, fetching their aspect ratios, and afterwards pass the highest value to the contain-weighten call. With images == photgraphs I think the average usage is well covered the way how it is setup now. But with logos it could be go much further with aspect ratios. Maybe you can drop in a small list of real logo usage aspect ratios (with extremes), so that I get a grasp of what we are talking here?
-
Best way to get random quote displayed on refresh?
horst replied to kathep's topic in Getting Started
Hi @kathep, welcome to PW and the forums. As with the most things here, there are no "right way" to do it. There are a few more or less equal but different solutions possible. What come into my mind are three variations: a) simply going with single pages b) going with repeaters c) going with Profields Pagetable I would go with single pages: 1) build a page called tools or something that only serves as parent for stuff that is not used to be displayed directly to the forntend. Set the page to hidden. 2) Build a template called category, it only needs a title field I think create a page under tools called categories that should serve as parent for your categories build child pages under categories that have the template category and the title are the names of your categories you need 3) Build a template called quotes, build the fields you need to be on a quotes page: quote_text = textarea quote_author = text quote_category = page, best is to use it with ASM select!, the source for it is the category parent! etc and assign them to the template Build a page under tools called quotes as parent for all single quote pages create your quote pages there (if you have to many for a manually creation, there are also automated import solutions available) If you have all setup you can get the quotes from every where in PW with a selector like this // get all quote pages $quotes = $pages->get("/tools/quotes/")->children(); // get all quote pages of a specific category $quotes = $pages->get("/tools/quotes/")->find("quote_category.title=category1"); // get all quote pages of a few specific categories $quotes = $pages->get("/tools/quotes/")->find("quote_category.title=category1|category2|category3"); // to get only one random out of those collections you call ->getRandom() at the end $quote = $pages->get("/tools/quotes/")->find("quote_category.title=category1|category2|category3")->getRandom(); If you get stuck at some point with this, come back and tell us. -
ok, then add a "include=all" to the selector, just to be sure that there are no pages get excluded because of restrictions! $result = $pages->find("has_parent=$p, include=all");
-
Have you double checked that the ids of your pages are correct? $ids = array(1050, 1080, 1090); foreach($ids as $id) { $parent = $pages->get($id); if (0 < $parent->id) { // page is found, lets call the selector $result = $pages->find("has_parent=" . $parent); echo "<p>found {$result->count} pages</p>"; } else { echo "<p>wrong ID for parent!</p>"; } }
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
horst replied to David Karich's topic in Modules/Plugins
@MikeB & @JoZ3: has anyone of you opened an issue at Github? Maybe there it get better recognition. -
Yes it is. But you have to do it by yourself. And I think it isn't an easy task for a newbie. Maybe you read upon those links that Mr-fan has provided above? Maybe you will find another solution than to recoding the pages tree. And BTW: a tree is a tree, it starts from the roots and goes up until it reaches the top. I have never heard about a tree that groups his branches by colors of the leaves or by thickness of the branches. Mr-Fan has pointed you to Lister already.
-
to 1) I have read yes. You, as a developer, can run mails on behave of different clients. You can/should create subaccounts for each client and you also can point to subdomains of your clientdomains. This can be used to only have own domain names in the links of a mail. (create a sub.domain.tld and point its CName to your mandrill subaccount) to 2) I don't know what HIPAA-compliant is.
-
for users from phpclasses.org. Today I have read a bit from this podcast. A short explanation about Mandrill and transactional emails can be found right after the introduction in the text at "Mandrill by Mailchimp promotion for PHP Classes users (1:03)". You simply need to go to Mandril through a link or put in the promo code "phpclasses" on the Mandrill site. ALso they have a free plan for 12.000 per month without any promo code!
-
depending on your PW version: before 2.5: https://processwire.com/talk/topic/2942-or-in-pw-selectors/#entry29001 Hhm, cannot find it, but I could swear there is support for OR operators in selectors now in 2.5. Sorry, you need to search for it by yourself, maybe in the http://processwire.com/blog section. Or if someone reads this: do we have support for OR operators in PW 2.5 now? Where can we read about it?
-
I have updated the module to Version 0.1.0 beta and it has a new addition to the weighten option that can be used together with contain. The initial code I have taken for weighten calculations is from Martijn. I have changed it to simplify its usage so that you only need to specify a bounding square and have to switch it on, or additionaly prioritize landscape oriented images in two favours: x1, x2 or do the same for portrait oriented images with: y1, y2. (read more in the posts above) But if you (@Martijn ) like to use more different options, like with the original ImageFitBoundaries.module, you can use it by specifying different values for width and height together with the new value "comp##". For ## you set the value for compression like comp20, comp30, comp40 or whatever you like.
-
I'm not sure, but have you tried $pages->find("images.tags%=sport-1"); ?
-
$rowend = $member == $member->siblings->last() ? "</div>\n" : ( $key%3 == 0 ? "</div><div class=\"row\">\n" : '' ); ---------- ^--------------------------------------------------^ not tested but I'm pretty sure. You use surrounding braces where not needed, but not where they are needed.
-
It would be great if the wireMail function could be used for sending emails instead of the php mail function. This way people would be able to use it together with their favourite mail extensions. For example with SMTP support: wiremail-swiftmailer or wiremailsmtp
-
exactly! You can call size() with second param = 0 (zero), what is the same as calling width(). Pageimage::size build the names according to passed values for width, height and optional options for cropping and suffix: basename.widthxheight-suffix.ext and the code of the function for blog images should be look like that, because there is no $event->arguments(2) available like it could be when calling from templatecode: public function sizeBlogCloud($event) { $image = $event->object->getPageImage(); $width = (int) $this->input->get->width;//$event->arguments(0); // $height = (int) $this->input->get->height; //$event->arguments(1); // not needed here, or set it to 0 $options = array(); if ($width < $image->width) { // add a suffix if it is a resized version, don't add a suffix if it is the original unresized image $options["suffix"] = array("is"); } $resized = $image->size($width, 0, $options);
-
Ok, that -is suffix is also new to me, at least that it is implemented now. I remember we (Ryan, Nico, me) have had a talk 6 month ago that it would be good if image variations belonging to RTEs get flagged somehow. Without a flag there is / was a great chance that they get deleted with a call for $image->removeVariations(). Whereas all API created image variations in templates get recreated on demand after such a call, RTE-belonging images don't get recreated and the pages output was / is broken. Therefore it is a good implementation to flag them. @mike131: I think you should add the same code to your emulation: $image = $event->object->getPageimage(); $width = (int) $this->input->get->width; $height = (int) $this->input->get->height; $options = array(); if ($width < $image->width) { // add a suffix if it is a resized version, don't add a suffix if it is the original unresized image $options["suffix"] = array("is"); } $resizedImage = $image->size($width, $height, $options); $filename = $resizedImage->filename; ...