Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
  • Location
    Bucharest, Romania

Recent Profile Visitors

2,139 profile views

Gabi's Achievements

Jr. Member

Jr. Member (3/6)



  1. Thanks for replying, Diogo. I checked (because I didn't touch it, so it should be as the profile sets it), and it has both settings: 1084 is the ID of the "Tags" page. Also, it's not connected to PageAutocomplete, here you have the admin page for the "Technicals Details" from the blog, the field being set as AsmSelect:
  2. Hello, I'm trying to find a way to sort tags when editing a page. So I tried the blog profile with PW 2.3.8 on XAMPP 1.7.7/Windows 7. I found that while the tags field is defined as Select, in the editing form it is definitely a PageAutocomplete. I tried a custom selector ("parent=/tags/,sort=name") with the "Selectable Pages" dialogue and, sure enough, when I saved it, the page edit field changed to a Select. The PageAutocomplete option is not even available (I checked and it's installed). These are the first and only things I've done after install. Regarding sort, I then changed the input field type to AsmSelect keeping the custom selector, but the tags list is still not sorted (see the second image). OK, this one should be on a different topic.
  3. Hi Wanze, Thanks for taking the time to answer my question. Actually I knew about __get(), but my brain liked to believe half-baked measurements. I left the mistake in place, maybe it will be of some use for someone. I attached the variables to $page because at some point I used functions outside the template scope (I think) and I passed $page along with all variables to the said functions. But now I'm not using them anymore, so you're right, I don't need to assign them to $page. I made some experiments and found that retrieving the variables directly from the database is only around 60 msec faster than your method on XAMPP for a page using the variables both in the header and in the footer. Your method is much more maintainable, so it stays. All the best.
  4. Good day, gentlemen, I apologize if the answer to my question exists already, I just couldn't find it. I'm working to have a group of global data such as tagline and contact info. I defined a hidden page ("sys") to store in its fields all the required data. Then the template (actually a prepended script) retrieves and attaches them to $page, like this: $sys = wire('pages')->get(1222); $page->tagline = $sys->headline; $page->contact_name = $sys->contact_name; $page->company_name = $sys->company_name; $page->company_address = $sys->company_address; $page->city = $sys->city; $page->country = $sys->country; $page->tel = $sys->tel; $page->email = $sys->email; $page->tel = $sys->tel; However, I was surprized to see that using the "$page->get('selector')" is 3 times faster than "$page->selector" (even if we're talking about 30msec vs 90msec on localhost): $sys = wire('pages')->get(1222); $page->tagline = $sys->get('headline'); $page->contact_name = $sys->get('contact_name'); $page->company_name = $sys->get('company_name'); $page->company_address = $sys->get('company_address'); $page->city = $sys->get('city'); $page->country = $sys->get('country'); $page->tel = $sys->get('tel'); $page->email = $sys->get('email'); $page->tel = $sys->get('tel'); Wrong conclusion. I think I just witnessed the cache at work. They actually have the same speed. I also thought of hard-coding them in /site/config.php. I know, not very clean and requires further work for multilingual data, but it seems it will be faster. Another one would be a custom query to select all the data in one pass. Which way would be the cleaner/faster/powerwirish one? Thank you.
  5. Thanks for your answer. I realize I should've been more specific: my main concern is the content of the /site/assets/files/ folder which is automatically created every time you create a new page. Let's say when you save images belonging to a page. Did you change the location where those images are saved? I thought it would be easier to just move the entire assets folder, but moving just the /site/assets/files/ would be just as good. LATER EDIT: I'm obviously a little slower. I realize now that creating subdomains pointing to the same folder allows me to serve them without moving them. But not using the API. Or a real CDN. Am I missing something (again)?
  6. Good day, gentlemen! Can ProcessWire use an /assets/ folder form a different domain/subdomain, as recommended for static content (http://developer.yahoo.com/performance/rules.html#cookie_free)? I looked into /index.php and it seems that the paths/URLs are stored as site root + folders (i.e /processwire/ + /site/assets/ for the assets url). The site root gets always prepended to the folders so I couldn't simply reassign the property.
  7. Hmm, I must confess that the PageAutocomplete was in a Repeater that was in a tab . But I'm happy to report that in the dev branch the PageAutocomplete does work in a Repeater which is in a tab. I just realized that I like more to see all the already defined tags, so I'm keeping the AsmSelect. When time and brain allows, I'll try to see if I can cobble together a Page input field like the tags field from MODx 2.x. Also I'm happy to report that my slideshow is coming up nicely. Thank you all! Oh, and I absolutely love the way ProcessWire makes whatever I want it to do. Ryan, you should embed The Three Laws of Robotics in ProcessWire before it's too late!
  8. I'm running 2.3 stable. So, a PageAutocomplete doesn't work in a Repeater, but an AsmSelect does. I like the natural way of entering items in a PageAutocomplete, but I also like that you can see all existing Pages in an AsmSelect. If both would've worked I would've been forced to choose . I think I'll stay with this version... So, I have now a Repeater with an single Image field - no tags, no description -, a TextLanguage field for the HTML alt attribute and a Page field with AsmSelect input for tags. And I can always add more fields if needed. My only discomfort is because of the interface - I think the admin style puts too much weight on the labels.
  9. Man, I'm stupid! Tags already have multi-lingual fields. My mistake was that I didn't connect images to the tags - i.e. my mind was considering image tags being different from the page tags. Don't ask me why, I don't know! This forum is different! I ask a question and the answer comes directly into my brain! LATER EDIT: the Alt field is still a TextLanguage field attached to the Repeater. Is there a better option? LATER LATER EDIT: it seems like a PageAutocomplete field doesn't work inside a Repeater? Is that right? Right now, I'm back at square 1 (not 0, mind you, I still have my Alt multi-lingual field). But how do I connect images with tags Pages? Hmm, doesn't seem like a multi-lingual question anymore.
  10. Good day, gentlemen! I'm trying to make a slideshow based on tags like this: 1. the slideshow is a Page field that gets the tags; I check the checkboxes for the tags I want to show as slide, giving me a tags list (PageArray) 2. a list containing all the portfolio pages that have tags in the list from 1 is generated 3. a list of images that have tags in the list from 1 and are contained in the portfolio pages in the list from 2 is generated 4. get a certain number of random images in the list from 3 5. output as one slide This introduction was made just to set a context. The question comes now: I want my images to have alt and tags fields. Multi-lingual alt and tags fields, that is. If it was not for a multi-lingual site, I could use the Description and Tags fields for that. But it is. So I made a Repeater with an single Image field (no tags, no description) and two multi-lingual fields. It feels a bit clunky to me. Is there a better solution? Thank you.
  11. Thanks for your answer. So, new questions: 1. Why is better to have the 'cropping' setting ignored at upload time? Or what are the problems avoided by ignoring the 'cropping' setting? I thought that if I put this setting in config.php it will be regarded as a general preference, in the back end as well as in the front end. 2. Regardless of the cropping setting, why is better to resize the images in two passes (first, the width, and if the heigth is still greater than the limit, the heigth)? In the end they're all going to $pagefile->size(). 3. For my slideshow I needed 550x261px images that would purposefully not be used elsewhere. With my modification I could upload them, they would be cropped on upload and then could be used as is. What would be the right processwirish way to set it? Don't get me wrong, I only want to understand the way ProcessWire works and the reasoning behind some coding decisions. I love ProcessWire and the way it stands out of the way giving you tools for your work. Thing is, I'm a beginner and often find myself hesitating between all the tools given by PW. Thanks for your time.
  12. Hi, I made a slideshow from a repeater with two text fields and an image field. I set the imageSizerOptions['cropping'] = true in config.php, but the images were not cropped on upload. So my uploaded images ended with aspect ratios of the originals. I dug in the code to find that in /wire/modules/Inputfield/InputfieldImage/InputfieldImage.module, ___fileAdded function, the image gets resized in two passes, first the width, then the height. It seemed to me that this is like telling PW to ignore the 'cropping' option. So I replaced lines 41-53 from InputfieldImage.module if($this->maxWidth && $pagefile->width > $this->maxWidth) { $pagefile2 = $pagefile->width($this->maxWidth); unlink($pagefile->filename); rename($pagefile2->filename, $pagefile->filename); $pagefile->getImageInfo(true); // force it to reload it's dimensions } if($this->maxHeight && $pagefile->height > $this->maxHeight) { $pagefile2 = $pagefile->height($this->maxHeight); unlink($pagefile->filename); rename($pagefile2->filename, $pagefile->filename); $pagefile->getImageInfo(true); } with if (($this->maxWidth && $pagefile->width > $this->maxWidth) || ($this->maxHeight && $pagefile->height > $this->maxHeight)) { $target_width = $this->maxWidth ? $this->maxWidth : 0; $target_height = $this->maxHeight ? $this->maxHeight : 0; $pagefile2 = $pagefile->size($this->maxWidth, $this->maxHeight); unlink($pagefile->filename); rename($pagefile2->filename, $pagefile->filename); $pagefile->getImageInfo(true); // force it to reload it's dimensions } I don't know if my logic is right, but it seems to work for me. What do you think?
  13. Sure, Pete, I can name the checkbox "hidden from menus" and turn the logic around, no biggie. And Ryan, thank you for letting me know the reasoning behind this.
  14. Oh, nice one. Thank you. I do have to read more about OOP. Right now I feel somewhat dizzy because of the posibilities of ProcessWire. Decision block, all that stuf . One more question, if you don't mind: what are the benefits of defining widgets as pages/templates instead of, let's say, using some functions included in the template file? Other than the posibility to alter the item count or the widgets' position/presence on a per page basis.
  • Create New...