Jump to content

Robin S

Members
  • Content Count

    3,868
  • Joined

  • Last visited

  • Days Won

    229

Everything posted by Robin S

  1. Is it possible to use the "selector" option to choose menu items based on parent? I tried... "selector" => "parent=1020" ...and... "selector" => "parent=/my-page/" ...but neither of these worked. I know I can do this by setting a PageArray as the root object but I'm trying to understand why I can't do this with the selector option.
  2. I've noticed that the search box in the header of the ProcessWire website and forums doesn't work very well. For instance, how is that a search in the Modules section for "admin custom files" doesn't deliver the page for the module with this exact name as the first result, or even anywhere on page 1? It doesn't appear in the results until page 4 of 5. The forum search isn't great either, and maybe that's down to IP.Board. But what about the rest of the official PW site? Is that running on ProcessWire? It seems like a bit of a bad advertisement for PW if the official site is running it but the search doesn't work well. I find myself relying on the Google Custom Search to find things. Are there plans to improve the built-in search on the ProcessWire website?
  3. I think I understand what this module does but I'm having trouble grasping the situations in which it would be useful based on the examples you've given. Is it just a convenience thing, so the editor doesn't have to look elsewhere for some information that might affect the content they decide to add to the page?
  4. Don't think this made it into the default admin theme, so +1 for this.
  5. I'm a bit late to this thread, but I just thought I'd add that there is a config option for opening "View" links in a new window from Page Edit: viewNew = 1 I don't think there is a config option for the view links in the page list though - would be great if there was.
  6. This solved issue one for me: CKEDITOR.on("instanceReady", function(event){ InputfieldColumnWidths(); });
  7. The "setHeight" function sets the height of a filler div to equalise the height of inputfield columns in the admin, so everything looks neat and tidy. I like this and the overall attention to detail in the admin UI, but I've notices a couple of issues with this method of equalising columns. 1. The function fires on document ready but this doesn't allow time for CKEditor fields to load and these can change the height of a column by quite a bit when loaded. Perhaps setHeight should fire on window load instead of document ready? (Edit: I tried this and it doesn't solve the issue. Probably needs to fire on a callback from CKEditor). Or perhaps a CSS-only solution could replace this Javascript approach, utilising display:table-cell or flexbox? 2. The function fires even when the viewport is narrow enough that the layout has switched to single column. In this case the heights don't need to be equalised because the columns are stacked on top of each other, and the extra filler space looks weird. This issue affects the Form Builder module too, where the filler div can cause the form to expand beyond the height of its iframe. I cludged together a CSS fix for this like so... @media only screen and (max-width:767px) { .maxColHeightSpacer {display:none !important;} } ...but it might be better to use something like enquire.js to make sure the function only fires above a certain breakpoint. Edit: just discovered another small issue... 3. The function doesn't fire after images and files are added to a field, which of course changes the height of the field. Is there an AJAX callback for image/file uploads I can use to retrigger the function? Any thoughts?
  8. @Christophe I think in your second menu you want $rootPage = $page->rootParent;
  9. When rendering two navs on the same page it seems that the first interferes with the second. If my first nav is... $menu = $modules->get("MarkupSimpleNavigation"); $items = $pages->find("parent=news"); echo $menu->render(null, null, $items); ...and then my second nav is... echo $menu->render(); ...then that second nav only shows children of news even though no PageArray is passed in to the render method. Even if my second nav is... $second_menu = $modules->get("MarkupSimpleNavigation"); echo $second_menu->render(); ...it still seems to be limited by the PageArray of the first nav. Can someone explain where I'm going wrong here? Thanks.
  10. Okay, I understand. My PHP skills are not fantastic but I expect that I could use your module as a guide to creating my own textformatter. If I can get a class on images in the RTE then I'll see if I can work out a textformatter that generates image markup based on class. That's true, but it seems like a drastic step to throw away the original image resolution to achieve a particular size for frontend use. If a larger size is ever needed you no longer have the original image.
  11. The ProcessWire image plugin used in CKEditor has some great features that give editors a lot of options when inserting images into RTE fields. Giving site editors this much control is good if those editors are technically literate and make wise layout decisions. In my experience this is often not the case. Rather than let editors choose to center an image here, insert a 3000px image there, upscale an image here, link to an original there, etc, I'd rather be able to set up some predefined options and then let editors choose from them when inserting an image. And I'd like to have those options be reflected in the appearance of images inside the RTE window after the image has been inserted - so a "full-width" image appears as such, "logo" image is small and floats right, etc. In other systems I've achieved this through the use of classes: when inserting an image editors choose from a dropdown of classes. These classes can then be used to control the appearance of images in the RTE window (via custom CSS styles for the RTE) and used to determine the final frontend result via PHP processing or jQuery selectors. A couple of ways the Page Edit Image module could be enhanced... Simple Allow custom classes to be added to images when they are inserted, just like the Page Edit Link module does.This would allow custom styles to be applied in the RTE window, and site developers could write their own Textformatter modules to apply different markup based on class or do things client-side with jQuery. Even better! Provide an interface in the module configuration that allows image "profiles" to be defined. Useful options would be:resizing cropping create link to enlargement (with resizing options for enlargement - the current option of linking to the original isn't ideal because the original is often much larger than needed). CSS rules for the profile to apply in the RTE window (float, width, etc)
  12. Nice module! A feature request: add an option for auto-linking images to a larger version of the same image, for use in lightbox enlargements. The core pwimage plugin for CKEditor allows for linking to the original image but often the original image is much larger than is needed, and I'd rather specify the enlargement settings myself than leave it to site editors.
  13. Currently ProcessWire names image variations like this: myimage.[width]x[height].jpg But there are other image sizer config options that affect the image variation - namely upscaling, cropping and quality. If you change any of these config options after you have already generated an image variation at the same dimensions you don't see the result on the frontend, rather you get the old cached version. There is a module that can clear image variations, but the problem could be avoided if the config options were included in the variation filename. Something like: myimage.800x600.u-0.c-north.q-70.jpg
  14. Just picking up on Ryan's earlier comment: I did this recently for pages containing multiple images and descriptions and thought I'd share the code snippet. If your CSV data for the temporary textarea field ("desc_temp") is formatted like this... image1.jpg=A description for image 1 image2.jpg=Another description ...etc, then after importing you can apply the descriptions with... foreach ($mypages as $p) { $p->setOutputFormatting(false); $desc_lines = explode("\n", $p->desc_temp); foreach ($desc_lines as $line) { list($file, $desc) = explode("=", $line); $image = $p->images->get("name=$file"); $image->description = "$desc"; } $p->save(); $p->setOutputFormatting(true); }
  15. A couple of ways I have dealt with static file versioning in PW: 1. Use AIOM+ for your CSS and JS files. AIOM+ is sensitive to what is contained in your files though - I got an error when my CSS contained a background image path to a PHP script (for generating translucent PNGs for older browsers that don't support rgba colours). 2. A function that renames static files according to the last modified time (adapted from this article). Include somewhere before your template head is generated... function autoVer($url){ $name = explode('.', $url); $lastext = array_pop($name); array_push($name, filemtime($_SERVER['DOCUMENT_ROOT'].$url), $lastext); $fullname = implode('.', $name); echo $fullname; } Use as follows for your CSS and JS... <link rel="stylesheet" href="<?php autoVer('/site/templates/css/mystyles.css'); ?>"> <script src="<?php autoVer('/site/templates/js/myscript.js'); ?>"></script> Add to your .htaccess, after "RewriteEngine on"... # Versioned static files RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L]
  16. @sforsman Thanks - your suggestion is just what I need. I thought I wouldn't be able to use a selector because the pages I want to select don't share any common attribute (parent, template, etc). It didn't occur to me that I could just find a list of names. @horst Thanks for the reply - sforsman's suggestion is probably the solution I need but I'm interested to understand how the import method could be used. The import method accepts a PHP array or a WireArray - I take it you're suggesting a normal PHP array rather than a WireArray seeing as my question is how to get items into a PageArray (WireArray) in the first place. I tried the import method and it worked with an array of page IDs... $ids = array(1041, 1042, 1043, 1044, 1045); $items = new PageArray(); $items->import($ids); ...but it didn't work with an array of page names... $names = array("/page-1/", "/page-2/", "/page-3/", "/page-4/", "/page-5/"); $items = new PageArray(); $items->import($names); Is there a way to use import with page names?
  17. I want to create a PageArray containing a number of pages that I will select by name (to use with the MarkupSimpleNavigation module). I'm using the code below and it works fine... $items = new PageArray(); $items->add( $pages->get("/page-1/") ); $items->add( $pages->get("/page-2/") ); $items->add( $pages->get("/page-3/") ); $items->add( $pages->get("/page-4/") ); $items->add( $pages->get("/page-5/") ); ...but it seems a bit long-winded. Is there a way to add multiple pages to my PageArray in a single line? I'm not looking to create a PageArray via selector; I want to manually add pages by name.
  18. Great module. One thing that's missing from the field setup options is the ability to set the geocode checkbox to "off" by default. The site I'm building requires editors to drop map pins that don't correspond to any street address and I expect they're going to be confused when the address field geocodes to some distant street address.
  19. Does Padloper have any features for handling inventory? For example, reducing the count of available stock after products are ordered.
  20. After clicking the "Export as CSV" button the browser "loads" for about four seconds then stops loading. No errors displayed in browser, no errors in ProcessWire error log, and no error logs in the module folder. Basic shared hosting, PHP 5.4, memory_limit: 64M, max_execution_time: 30. Exporting the same data via Ryan's CSV export addon for Lister Pro works fine (which solves my CSV export needs).
  21. I'm confused about how to add styles and scripts to my custom admin page. The docs say: ...and then... So I take this to mean I have to add the "ACP_scripts_and_styles" field to the "admin" template, but admin is a system template and so is hidden unless Advanced Mode is activated. So do I need to activate Advanced Mode in order to add this field? --- Edit: After going ahead and trying it I think I can answer my question above with a "yes". This isn't obvious though, and I think the module would be easier to get started with if the "ACP_scripts_and_styles" field was added to the admin template when the module is installed, like the "ACP_template" field is.
  22. Great module! Exporting to CSV works well for small to medium numbers of child pages, but is failing silently for large numbers of child pages. In my case, around 3000 children, with 20 fields per page. I'm probably asking a bit much to try and export such a large volume of data. Maybe large exports like this could be done in batches somehow?
  23. A couple of minor issues I noticed when the CSV being imported contains File fields: 1. Filenames get converted to lowercase, so "MyFile.pdf" becomes "myfile.pdf". 2. There's no notification if the file doesn't exist at the path given, and a dummy file can end up being created containing the 404 HTML markup. So if the file path I'm importing is "http://mywebsite.com/tempfolder/myfile.pdf" and there is no such file at that path, a file "myfile.pdf" gets created in "/site/assets/files/..." but this file is not a valid PDF and actually contains the HTML for the 404 page. Edit: another anomaly is that page titles are truncated if they include an en dash. Turns out that's an issue with the CSV not being encoded as UTF-8. Good ol' Excel.
  24. @sarah_hue Also, if you're not wanting to match partial words you don't need to do the explode/foreach. The ~= operator will match multiple whole words in any order.
  25. Great, thanks. I used explode to get the individual words from the search query and then a foreach to build the selector. $selector = ''; if($input->get->general_search) { $value = $sanitizer->selectorValue($input->get->general_search); $terms = explode(" ", $value); foreach($terms as $term) { $selector .= "title|author|source|keywords|bibliography_type%=$term, "; } $input->whitelist('general_search', $value); }
×
×
  • Create New...