Jump to content

Pete

Administrators
  • Posts

    4,054
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. Yup - you would create a template for team member and another for events and then create pages using those templates. What I would do is create a new template with nothing but a title field and call it "Team Members" and another the same called "Events" and set the page to be hidden in its settings (therefore it won't show in navigation and nor will its child pages - hidden pages are excluded by default). Then under that page, use the relevant templates and create your team members and events. It takes a while to wrap your head around the fact that pages aren't just pages, but once you get to grips with that the possibilities are limitless
  2. I believe ther's a "remove formatting" button if you're talking about highlighting a piece of text that's styled and removing that style. The button name is removeformat and I don't think it requires a plugin. There's also a button to cleanup messy code (in case pasting something in creates a mess) but I think you may have already put a restriction on what gets pasted so this one might not be required. EDIT: Just tested it in MODx and I see what you mean about stacking up styles. The removeformat button nicely clears it though. I guess it's just a case of if you're using styles then tell your client to be careful and give them the removeformat button in case they do get into a pickle
  3. Cool - cheers ryan
  4. It's possible that caching may not be needed, but I'm looking into it as it's a fairly well-visited site with a few hundred thousand page views a month (not massive, but not small either, so any increase in loading time is a bonus). The real reason I was looking into it is that by the time I'd finished my article template I'd called in various other bits and bobs (an example being Google's YouTube API for PHP to fetch and display a video - used the API as I needed to check if a video had a screenshot with it - most do, but you can't check without the API), plus there were a lot of blocks put together from content from other pages that, whilst the content won't change, was enough that it got me thinking about the overhead as one of the templates will be pulling in information from about 7 different pages so if I can cache that then that would be good. Thanks for the module - that looks to solve my problem completely since 95% of the content will never change, but those two bits will. I was also wondering if the way you and some of the others use templates could also achieve the same result? Not a problem if it doesn't, but I was just curious.
  5. Hi chaps I've got a quick question about caching - I can't cache a whole template as I've got stuff in head.inc that needs to remain dynamic throughout the site. Is there some way to get around this? Also, if there is a way to achieve this, is there a way to make part of a template that's set to be cached non-cacheable? My example is that I have an article template that includes the head.inc and foot.inc files. There's a member bar in the head.inc that needs to remain un-cached (it can display alerts for new messages from my forums etc). Further down the article template is a section that spits out the latest comments on the article - again from my forums - and so that cannot be cached either. I realise I could use MarkupCache to cache certain bits of the page around the non-cache items and just append the page ID to the cache names, but that could result in many thousands of small cache files in one folder which isn't too tidy, plus I'd prefer to have the options that are available in the template cache (as in the knock-on effects on other pages in the site). Any suggestions are most welcome On another note, I have a suggestion to improve the cache feature: I have a field in my articles template called "game" (it's a gaming site, but it may as well be a blog or other article site). Each article is linked to one or more games using this field. Each game page never changes often, so can be cached indefinitely aside from one small block of code that fetches in a list of related artilcles. Currently in the cache options, we have the setting: "Clear cache for the saved page and other pages that I specify...". I think it would be great if there were a similar option where you could specify "Clear cache for the saved page and other pages in the following fields..." - then you could select fields linked to other pages that you know will have to have their cache emptied too. That way you can more specifically target which pages are cleared. My only problem there is that I would need to have that option in addition to "Clear cache for the saved page and parents (including homepage)" so I'm not sure how that could work on the current form - maybe just as a checkbox in addition to the radio buttons so they can be used in combination, which I imagine would then cover all scenarios.
  6. Ah right, I was trying to preview a particularly lengthy article
  7. Hi Nico I get the following error: Is it trying to pass the entire page body in a $_GET var? That's what it appears to be doing on my installation anyway
  8. (sorry, checking the upload limits slipped my mind - glad you found it Ryan!)
  9. No problem Antti, and apologies in advance if it was something I did!
  10. I would recommend just browsing through their Site Templates section. I believe the others will be tailored for specific CMS systems, whereas one of their normal site templates simply provides HTML and CSS that can be quickly adapted for use with ProcessWire.
  11. Okay, looks like I took out a bit of code accidentally which causes my error. In InputfieldCropImage.module, before this line: $page = $this->pages->get($this->input->get->id); add this $cropUrl = "../image-crop/"; I don't think this has anything to do with the hover not working to preview thumbnails though - not sure what that is to be honest, possibly something with a newer version of jQuery maybe? I can't figure it out though it is affecting my PW 2.2 site. I'll commit my latest code change shortly and do another pull request Antti.
  12. On top of that, I'm getting an odd error, but only on ONE site where this is used (all of them updated t the latest version, only one showing the error): Notice: Undefined variable: cropUrl in C:\xampp\htdocs\blah\site\modules\InputfieldCropImage\InputfieldCropImage.module on line 48
  13. I'm seriously contemplating looking at this one for a project I'll start next month to be honest. It's one of those things - if you're not doing a very stylised design then it could save lots of time. Even if you are, just don't use the bits you don't need and customise the rest. I must say I'm always re-inventing the wheel with each website which wastes time - I've not got a set starting template or CSS which is a little silly.
  14. That would require some HTML and CSS knowledge as it's not just another off the shelf theme. For the CSS, you would want to look in site/templates/styles/main.css and for the template layout you would need to tweak site/templates/head.inc and foot.inc If you're not too comfortable with CSS and HTML then it would be worth looking through some template websites - either free ones or cheap ones like Themeforest and it wouldn't take too much to implement a new template.
  15. Ah yes, I remember that discussion about different ways of displaying templates/content now.
  16. I think he means head.inc - the code would certainly work there
  17. No problem Hani - I thought it would be quite a useful addition as you don't need to see the thumbnail options where you don't need them, plus it can reduce confusion for clients too if they apply a crop and the crop tool isn't used in a particular template.
  18. Passthroughs in PHP seem to be the standard for a lot of file download systems to be honest. I might be wrong, but with some cleverness you can also allow it to resume interrupted downloads this way which I'm not sure you can do with a direct link. This is the function that actually handles the download in the script I've used previously (it's getting on a bit now ). // Print the http header header("Cache-control: private\n"); // fix for IE to correctly download files header("Pragma: no-cache\n"); // fix for http/1.0 header("Content-Type: ".$filetype); if ( $myrow["realsize"] ) header("Content-Length: ".(string)($myrow["realsize"]) ); header("Content-Disposition: attachment; filename=".$filename); header("Content-Transfer-Encoding: binary"); // Open and display the file.. fpassthru( $fh ); @fclose( $fh ); exit(); } // there was some error message generation code at this point that's not relevant The above is using some variables from a database query (this system acatually masked the filenamess with some form of MD5 hashing so you can't tell what's what if you look at the files on the file system itself, and it pulls various bits from the database to pass the file to teh suer with the correct name and increment download counts etc. All of that is a bit over the top, so I've just copied in the relevant bit in case it's useful.
  19. Happy to help I'll do it tomorrow when I'm back at my computer (and can figure out GitHub again - I don't use it often enough to remember how it works ).
  20. You're probably expecting $config->urls->root to return a full URL (I'm guessing) in which case you need $pages->get('/')->httpUrl; See this thread for info:
  21. Hey Antti (and others) - I went ahead and made it so that the module can now accept comma-separated lists of templates per thumbnail config. For example, in the module config, enter a new crop setup called bigthumb like this: bigthumb,320,240,home,search The two extra parameters on the end are templates that this is applicable to. You can keep adding templates to the list to your hearts' content, and in this case it won't show you a thumbnail option for the images field on the basic-page template since you narrowed it to a specific list. If you want the thubmnail to be available to all templates, simply don't add any more parameters after the first three The code, oddly enough, is in the same function as my last post, so change that entire function in InputCropImage.module to the following: protected function renderItem($pagefile, $id, $n) { $out = parent::renderItem($pagefile, $id, $n); $crops = $this->modules->get('ProcessCropImage')->crops; if (strlen($crops)>3) { // If we've defined one or more templates for specific crops, we need to check the current page's template to see if we actually have any applicable crops to show to the user $page = $this->pages->get($this->input->get->id); $applicableCrops = array(); $cropArray = explode("\n", $crops); foreach ($cropArray as $k => $v) { $cropItems = explode(',', $v); if (count($cropItems) > 3) { if (in_array($page->template, array_slice($cropItems, 3))) { $applicableCrops[] = $cropArray[$k]; } } else { // Any non-template-specific crops are automatically added to the list for all cropimage fields $applicableCrops[] = $cropArray[$k]; } } $applicableCrops = implode("\n", $applicableCrops); if (!empty($applicableCrops)) { $cropLinks = $this->_getCropLinks($crops, $cropUrl, $pagefile); if (!empty($cropLinks)) { $cropUrl = "../image-crop/"; $cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($applicableCrops, $cropUrl, $pagefile) . "</div>"; // We add our crop string at the end of the list item that holds image $out .= $cropStr; } } } return $out; } If no crops are applicable to a particular template, it simply doesn't render the thumbnails box below each image.
  22. Fixed it. This just needs tidying up and putting into the source, but if you open InputfieldCropImage module and find the relevant function below and replace it with the code below: protected function renderItem($pagefile, $id, $n) { $out = parent::renderItem($pagefile, $id, $n); $crops = $this->modules->get('ProcessCropImage')->crops; if (strlen($crops)>3) { $cropUrl = "../image-crop/"; $cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($crops, $cropUrl, $pagefile) . "</div>"; } // We add our crop string at the end of the list item that holds image $out .= $cropStr;//str_ireplace('</li>', $cropStr, $out); return $out; }
  23. I've just encountered the same thing. It displays as a normal image field as you say and I get none of the crop links for my configured crops next to the images.
  24. For the pages, you would use something like $yourpagelist = wire('pages')->get(your-selector-here)... I thinkthe rest will more or less follow the same structure as above if you see what I mean?
  25. Just going back to the option of storing it outside of the web root, it doesn't look like it would be too hard to create a new fieldtype based on the InputfieldFile.module Obviously this doesn't help you in your current situation, but I'm thinking out loud so ryan could possibly comment on this ryan - it seems that there is a $this->destinationPath variable. Whilst you can't link directly to a document outside the document root, is it technically possible to extend the module and have it create a folder outside the root, then set this variable to point to it (and on a page-by-page basis have it create a subfolder with the document ID as the subfolder name?). If so, then with a little work it wouldn't be too hard to have the path configurable (I think). Since you can't automatically serve a file that's above the document root directly, there would need to be a function in the module that deals with this as well, but I think that if this sounds do-able to ryan then I might take a stab at it at some point in the future (next few weeks are pretty busy, but after that then maybe ).
×
×
  • Create New...