-
Posts
5,009 -
Joined
-
Days Won
333
Everything posted by Robin S
-
Or: // get publication from this author $publi = $pages->find("template=publication, author=$page"); Author and Member are the same thing, right?
-
I get the reason for having manual control of where links/abbreviations appear, but what do you think about adding an option where terms are replaced automatically? It would be nice to give the user the ability to add new terms to the glossary without having to go through all their pages looking for where the term appears and adding the ||term|| syntax manually.
-
I believe the lazy cron can be triggered on every pageload by every user, including guest, and you don't need to add the db-backup permission to guest for this to happen. I asked about this too and @kixe responded... Agreed. Also, the module description on GitHub and the modules directory seems to contradict the above so perhaps that needs to be corrected?
-
CKEditor Feature Parity with Replaced Components
Robin S replied to Jason Huck's topic in Wishlist & Roadmap
Technically you can specify a subject line in the PW link dialog, but there isn't a dedicated field for it. mailto:me@mydomain.com?subject=my subject line -
Just wanted to add that if, as in the OP's case, you are going to foreach the children then there is no additional penalty to using $page->children()->count() because you will be loading the children into memory anyway.
-
I gotta say, how awesome is that we're in a community where we can hire PW's main man to help with our projects?! Like, can you imagine a world where you can't decide on your Facebook cover image so you call in Zuckerberg for a consult?
-
A couple of errors in your function... $output .="<h1><?php echo $page->title; ?></h1>"; The PHP tags shouldn't be here and you cannot echo inside a variable declaration. {$pages->about} ... {$pages->maincopy} These don't make sense - maybe you meant $page ? And totally a matter of preference, but I find... $output = " <div class='container'> <div class='row'> <div class='col-md-12'> <h1>{$page->title}</h1> </div> </div> </div> "; ...more readable than... $output = ""; $output .="<div class=\"container\">"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\">"; $output .="<h1>{$page->title}</h1>"; $output .="</div>"; $output .="</div>"; If you're considering switching to functions instead of includes because of performance concerns I wouldn't bother. It's true that you would avoid some file loads but you'd have to have a lot more includes before this would make a difference worth caring about. One thing to think about when considering a switch from includes to functions is variable scope. Basically, includes have access to variables defined outside of them but functions do not unless you pass the variable to the function as a parameter. This can be a help or a hindrance depending on your needs. Lastly, you could consider using $files->render() (aka wireRenderFile). A file rendered this way has access to all API variables and you can pass in an array of your own variables for use inside the file. I'm not 100% clear on the benefits of this over a normal include but I guess it has to do with the isolation of variable scope (to avoid the risk of overwriting variables of the same name in your template).
-
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++; }
-
Saving certain pages brings me to a 404 error
Robin S replied to Thomasaur's topic in General Support
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. -
Saving certain pages brings me to a 404 error
Robin S replied to Thomasaur's topic in General Support
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. -
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
-
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++; } }
-
-
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
-
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/
-
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...
-
"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
-
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.
-
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.
-
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"); } });
-
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(); } }
-
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?
-
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.
-
"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?
-
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)