Jump to content

Robin S

Members
  • Posts

    4,791
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. Rather than put the "hidden" class on a containing div I would put it on the thumbnail links that you don't want to show. $album_iteration = 1; foreach($page->album_repeater as $album) { $image_iteration = 1; foreach($album->album_images as $image) { $class = $image_iteration == 1 ? '' : ' hidden'; echo " <a class='fancybox{$class}' rel='gallery{$album_iteration}' title='Gallery {$album_iteration} - {$image_iteration}' href='{$image->size(800,800,array('cropping'=>false))->url}'> <img src='{$image->size(200,200)->url}' alt=''/> </a> "; $image_iteration++; } $album_iteration++; }
  2. Sounds like nonsense to me - I've used many shared hosts and I've always been able to have mod security disabled for individual accounts. Maybe time to look for a new host? GoDaddy are not generally known for hosting excellence.
  3. Maybe they don't know what they're talking about You may be able to disable mod security yourself. In cPanel... ...or in htaccess... <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule> Or demand that your host disables it for your account.
  4. Hi Kekko, Welcome to the PW forums! In PW, image and file fields effectively store the images/files for the page they are on. Currently there is no fieldtype module released in the modules directory that acts a reference to images/files stored on another page. There have been a number of questions and requests about such a feature (for example here, here, here and here) and you could throw your support behind the item in the wishlist subforum here. I for one would love to see an image reference field for PW and it's on my list to have a go at developing some time but I fear it will be beyond my skill level. The only alternative to an image reference field that I'm aware of is to follow a page-per-image approach (i.e. each image is uploaded to a separate page, and then you use a Page fieldtype to reference the image in other pages). I haven't tried them, but there are some modules that can help if you want to use this approach: AutoImagePages ImagesManager FieldtypeImagesSelect ...and two commercial modules from @kongondo... Media Manager Visual Page Selector
  5. Here is another option that uses URL segments to get the individual repeater galleries. This would allow you to continue using the UIkit slideshow. // The repeater field is called 'galleries' $galleries = $page->galleries; // Set defaults $current_gallery = $galleries->first(); $gal_number = 1; // Deal with url segments if($input->urlSegment(1) !== '') { // Sanitize url segment and subtract 1 to adjust for zero-based index $gal_zero_index = $sanitizer->int($input->urlSegment(1)) - 1; // Throw a 404 if the url segment is out of range if( $gal_zero_index < 1 || $gal_zero_index >= $galleries->count() ) { throw new Wire404Exception(); } else { $current_gallery = $galleries->eq($gal_zero_index); // Add 1 to give one-based index $gal_number = $gal_zero_index + 1; } } if($input->urlSegment(2) !== '') { throw new Wire404Exception(); } // Gallery heading echo "<h3>Gallery $gal_number</h3>"; // Slideshow foreach($current_gallery->images as $image) { // Output markup for slideshow here } // Gallery links (thumbnails) $i = 1; foreach($galleries as $gallery) { if($gallery->images->count()) { $link = $i > 1 ? $page->url . "$i/" : $page->url; $class = $i === $gal_number ? ' current' : ''; echo "<a class='gal-link{$class}' href='$link'><img src='{$gallery->images->first->size(100,100)->url}' alt=''></a>"; $i++; } }
  6. For the record, PageListSelectMultiple does work with "Create New".
  7. Ryan introduces $this->halt() in this blog post and there is some explanation in the code too. Essentially just reiterating what Macrura says above, in your template file... // some template code here: this always gets executed if(/* some test here */) { return $this->halt(); } // some more template code here: this doesn't get executed if the if() statement above is true // also, if a file is specified in $config->appendTemplateFile this is not appended
  8. I think the problem you're having with the slideshow is a JS issue rather than a PW issue - as far as I can tell the UIkit slideshow component doesn't support dynamically adding/removing images out-of-the-box. And this is what you would need if you want the slideshow to load galleries according to which thumbnail below is clicked. You would have to code your own JS solution for this, which could be challenging. You might be better off to look for an image viewer script that has documentation/examples for loading galleries from a single link. For instance, if you were using Fancybox you could follow one of the examples below: http://jsfiddle.net/T6NKD/ http://jsfiddle.net/jekAe/
  9. From the module readme... And you can also use the core Autocomplete inputfield to add pages on-the-fly providing the conditions on the "Input" tab are met...
  10. "Missing required value" is a translatable phrase. I haven't used translations before myself as all my sites are in English, but I believe the process is: Setup > Languages > [your language] > Translate File (under Core Translation Files) > \core\InputfieldWrapper.php I created a GitHub issue regarding the obsolete code example in /wire/config.php
  11. I don't follow you here. If min width/height is 320/260 and max width/height is 1600/1600 (or empty) then a 320x260 image can be uploaded. The image must be smaller than the minimum to be refused - equal to the minimum is accepted.
  12. 1. Create all the fields you need relating to a single car. One field you don't need to create is "Title" because that is a global field that exists by default. 2. Create a template "car". To this template add the fields you created in step 1. This is the template that will output the fields for a single car. 3. Create a template "cars". This is the template that will output the list of cars. If it only outputs the list of cars it may not need any fields added to it apart from the default "Title". 4. Create a page "Cars" that uses the template "cars". 5. Create a child page of "Cars" for your first car that uses the template "car". Fill out the fields. Repeat this step for all your cars (see end of post for a time-saving tip). 6. Create template file "car.php" in /site/templates/. In this file output your fields as needed, getting each field as $page->my_field_name 7. Create template file "cars.php" in /site/templates/. In this file you will get a PageArray of all the cars and then loop over them to create links to the individual car pages. // get PageArray of all cars $cars = $pages->find("template=car"); // in this example you could also get $cars with: $cars = $page->children(); // Output list of links... if(count($cars)) { echo "<ul>"; foreach ($cars as $car) { // $car is the Page object for an individual car // You can get any field of the car with $car->my_field_name echo "<li><a href='{$car->url}'>{$car->title}</a></li>"; } echo "</ul>"; } Time-saving tip: you could import data for your car pages in bulk from a CSV using this module.
  13. You can filter the notices with a hook before Page::render in /site/ready.php The file compiler notices are useful information so probably sensible to filter these notices only for non-superusers. $this->addHookBefore('Page::render', function($event) { $user = $this->user; if(!$user->isSuperuser()) { $notices = $this->notices; $notices->not("class=FileCompiler"); $notices->not("text~=Compiled file"); } });
  14. Hi Nico, Welcome to the forums. Just wondering why you don't want to use the backend to edit your pages. My take is this: the whole point of the frontend edit features is that you stay on the page being edited. If you are navigating to a separate page for editing then that might as well be "Edit Page" in the backend - no need to reinvent the wheel. You can display a link to Edit Page in the frontend only to users who may edit the page: if($page->editable()) { echo "<a target='_blank' href='{$page->editURL}'>Edit this page</a>"; } Or if you wanted to keep the /url/to/page/edit/ scheme you could redirect to Edit Page: if($input->urlSegment(1) == 'edit') { if($page->editable()) { $session->redirect($page->editURL); } else { throw new Wire404Exception(); } }
  15. There have been a few issues raised here in the forums that seem to relate to SQL mode settings. There is nothing stated on the requirements page about SQL mode but it seems that certain mode settings can cause problems, and maybe even settings that are now enabled by default in MySQL 5.7. Might be a question for @ryan, or does anyone else know: What are the SQL mode requirements for ProcessWire?
  16. The settings for the CKEditor field are viewable in the page source of Edit Page: You could inspect the source to see where any other references to "mystyles" might be coming from.
  17. "mystyles" is working normally for me in the latest PW 3.0.28. Where do you see the error message - in your browser JS console? The error sounds like there is an attempt to load "mystyles" twice. Just guessing here - do you have anything in the "Custom Config Options" for the CKEditor field that refers to mystyles?
  18. I don't think this is quite right. If the image you are uploading is 200px high and the minimum height for the field is 260px then PW will refuse it, regardless of what is set for max width/height. So that part is okay. The problem happens when you set a max width/height and the image you upload is larger than both the max width/height and the min width/height. What happens here is that PW resizes the image to so it is contained by the max width/height while maintaining the image aspect ratio. And depending on the aspect ratio this can result in a resized image where one dimension (width or height) is smaller than the min width/height. So in the example you give... ...PW will actually scale a 1024x768 image down to 320x240, not 320x260. PW doesn't refuse the image because it was larger than the min width/height on upload, but it doesn't check if the resized image will be smaller than the min width/height limits. Arguably this should be checked, but if if what you want is an image cropped to exact dimensions you can just leave the max width/height empty (or some large maximum to avoid overly massive files - I often set max width to 1600px) and crop to your dimensions in your API calls: $image->size(320,260)
  19. Probably not the cause of your problem, but it is not valid HTML to wrap a link around a list item. The only element that can be a direct child of <ul> is <li>.
  20. Cool module! A couple of ideas/dreams for a future update: 1. It would be great to have thumbnails in the select dropdown for image fields. 2. Could there be an option for the last select in the chain to be a select multiple?
  21. If I understand right, you will be outputting all the repeaters on the parent page and each of these will include a link to the booking page. Because a repeater item is a page you can use the page ID to identify it. So on your parent page... foreach($page->my_repeater as $repeater_item) { $link = "/booking/?id={$repeater_item->id}"; // output the markup for your repeater item including the link } And on the booking page... $id = $sanitizer->int($input->get('id')); $repeater_item = $pages($id); if($repeater_item->id) { // output the markup for your repeater item } You could use a URL segment instead of a GET variable if you prefer.
  22. No pressure, but eagerly looking forward to using Batcher in PW3. In PW2 it was my go-to module for quick and easy bulk deletion of pages generated during site testing. Lister Pro can do that too but needs more clicks. Please keep the option of typing a selector too.
  23. Thanks for the suggestion. I haven't used Glyphs (it's not cross-platform and I'd need to upgrade my ancient Mac) but I was aware it can export webfonts. Because Glyphs is a font creator/editor first-and-foremost I think the workflow for webfont conversion might be a bit slow. I figure you would have to open and export each font individually. Or maybe some sort of batch script is possible. I heard back from Font Squirrel this morning and they have de-blacklisted the fonts I noted above. I'm pleased about that, and it sounds like I can contact them whenever I find a font that is wrongly blacklisted and they will correct that. So I think I'll persevere with Font Squirrel wherever possible and fall back to Transfonter if needed.
  24. I don't really understand what your page structure is and what you are trying to output. Maybe you could show... the structure of this branch of the page tree what templates are used at each level an example of what you want your output to be ...then it would be easier to help. But generally I think the problem is that you need to get $categ_team_year and $past inside your loop, using $categ. Also, you need to use count() in your if() statements when testing if a PageArray is empty. Maybe something like: $categ_team = $page->children("template=categ_team"); foreach($categ_team as $categ) { $categ_team_year = $categ->children("template=categ_team"); $past = $categ->find("template=member, actual=0"); $content .= "<h2><a href='{$categ->url}'>{$categ->title}</a></h2>"; if(count($categ_team_year)) { foreach($categ_team_year as $year) { // do something with $year } } if(count($past)) { foreach($past as $member) { // do something with $member } } }
×
×
  • Create New...