Jump to content

adrian

PW-Moderators
  • Posts

    10,877
  • Joined

  • Last visited

  • Days Won

    348

Everything posted by adrian

  1. Not sure if anyone else has come across this error yet, but it was driving me crazy - all of a sudden on one page of my site. At first I thought it was a code error. I went through the offending file and found that if I removed $item->sister_school->id then everything loaded fine. I couldn't even send that via error_log($item->sister_school->id) without the error. The value was sent to the log with no other errors, but the page still wouldn't load. All other browsers and even an incognito chrome window worked fine. Clearing the browser cache didn't help. Not sure what fixed it in the end, but I removed all these: Clear browsing history Clear download history Delete cookies and other site and plug-in data Empty the cache I think it might have been the cookies ... option since I had cleared the others not long ago anyway. Hope that helps someone, although I am still not sure why removing that line of code also stopped the error!
  2. I think within the entry for each show, you should define the theaters where it will play, not the cities at all. Your template code can then get the city from the theatre table/page. Make sense? Anyway, will leave you to it now
  3. Glad that helps. Just one thought about the structure I proposed. That will cause you problems if the shows are "on tour" and will play in multiple theaters if different cities - you'd have to enter them several times. It might be better perhaps if you could define most of the details of each show under a "Shows" parent and then somehow specify just the time for each actual performance (perhaps a child under each show labelled as the show date where you define just the datetime and the theatre) - hopefully you get the idea. The cool thing about PW is all the possibilities, but sometimes that can seem overwhelming too until you get the hang of it Anyway, I am sure some playing around with the skyscrapers demo will give you some ideas!
  4. Guess I am a bit confused as to the page structure that you have set up. You could do something like: City 1 Theatre 1 Show 1 Show 2 Theatre 2 Show 1 Show 2 City 2 Then the admin just has to create a new child 'show'under the appropriate theatre. There may be better ways to organize this depending on your needs on the front end. You could also follow Ryan's skyscrapers setup, and use some of that logic. Have you seen his demo: http://processwire.com/skyscrapers/admin/
  5. Since a theatre can only exist in one city, I don't think you should have multi as an option. You should set it to single and then change asm to a standard select. Then you'll be able to go back to $t->theatre_city->title Let us know if that works.
  6. That suggests that you have Multiple selected on the Details tab then. What happens if you do? foreach($t->theatre_city as $theatre_city){ echo $theatre_city->title . '<br />'; }
  7. I also just noticed this problem, so just a little reminder
  8. Do you have the page field set to multiple or single in the details tab?
  9. Not sure about collapsing the code window - don't think I've seen that option in this forum. But, back to your problem - all that your RSS page should be outputting is: <?xml version='1.0' encoding='utf-8' ?> <rss version='2.0'> <channel> <title>Latest updates</title> <link>http://localhost:8888/livio/rss/</link> <description>The most recent pages updated on my site</description> <pubDate>Thu, 18 Apr 2013 16:24:55 +0200</pubDate> <ttl>60</ttl> <item> <title>Sintel</title> <description><![CDATA[InfoPassepartout had a moist sensation about the eyes; his master's action touched his susceptible heart. Two first-class tickets for Paris having been speedily purchased, Mr. Fogg was crossing the station to the train, when he perceived his five friends of the Reform. "Well, gentlemen," said he, "I'm off, you see; and, if you will examine my passport when I get back, you will be able to judge whether I have accomplished the journey agreed upon." "Oh, that would be quite unnecessary, Mr. Fogg," said Ralph politely. "We will trust your word, as a gentleman of honour." "You do not forget when you are due in London again?" asked Stuart. "In eighty days; on Saturday, the 21st of December, 1872, at a quarter before nine p.m. Good-bye, gentlemen." Phileas Fogg and his servant seated themselves in a first-class carriage at twenty minutes before nine; five minutes later the whistle screamed, and the train slowly glided out of the station. The night was dark, and a fine, steady rain was falling. Phileas Fogg,]]></description> <pubDate>Wed, 03 Apr 2013 13:54:47 +0200</pubDate> <link>http://localhost:8888/livio/movies/sintel/</link> <guid>http://localhost:8888/livio/movies/sintel/</guid> </item> <item> <title>Big Buck Bunny</title> <description><![CDATA[]]></description> <pubDate>Thu, 04 Apr 2013 14:25:48 +0200</pubDate> <link>http://localhost:8888/livio/movies/big-buck-bunny/</link> <guid>http://localhost:8888/livio/movies/big-buck-bunny/</guid> </item> <item> <title>Tears of steel</title> <description><![CDATA[]]></description> <pubDate>Thu, 04 Apr 2013 15:41:36 +0200</pubDate> <link>http://localhost:8888/livio/movies/tears-of-steel/</link> <guid>http://localhost:8888/livio/movies/tears-of-steel/</guid> </item> </channel> </rss> Seems to me that your rss.php template has your header and footer includes in place. That file should just have the code you posted in your first post, and nothing else. Try that and let us know how you go.
  10. When you are viewing your RSS feed in your browser - something like www.mysite.com/rss/ - do a View Source in your browser. Paste the content of the source here and I am sure we can figure out the problem.
  11. Not a big deal, but I just went to move a page to a different parent. I changed the title, name, template and parent all at once and it returned an error saying it couldn't change the parent because the page's template wasn't allowed. It changed the template to the one I selected (which actually is allowed), but didn't change the title, name, or parent. I changed these again and it saved fine. So, I guess it needs to be able to make the template change first and then continue to process the other changes, rather than throw the error. Obviously I now know to do these sorts of changes in two steps, but it would be nice if it could manag it without needing this. Maybe it's too much of a pain to implement ?
  12. Hey Soma, Just went to install via the modules manager and got this notice (obviously not a big deal, but nice to fix): Notice: Undefined variable: success in /site/modules/ModulesManager/ModulesManager.module on line 393 BUT the following is a show stopper: ModulesManager: File could not be downloaded https://github.com/somatonic/ChromePhpLogger/archive/master There seems to be a problem with downloading or writing the module.
  13. I am not sure if there is a decent guide to this anywhere, and I have only set these up a couple of times now, so not sure I have everything in my head, but I think at a minimum you need to go to the access tab for the home template, select yes and then able edit rights for the editor role. You can also do this for child page templates at any level. One thing I found confusing at first was being able to separate things so that some users can delete and other cannot. This requires setting up a new permission called page-delete and a new role called "deletor" or something along those lines. Then you can assign the manager user editor and/or deletor roles. When you're on the access tab for a template you need to select "edit pages" for the deletor role if you want them to be able to delete. Key thing to remember is that you can limit access to a very detailed level. There are also a few modules that can make things even more detailed: http://modules.processwire.com/modules/custom-page-roles/ http://modules.processwire.com/modules/page-edit-per-user/ http://modules.processwire.com/modules/page-edit-field-permission/
  14. Hi Antti, Sorry if those comments seemed unappreciative. I completely see the value of being able to edit single fields separately on a page. Perhaps the idea of RenderAll doesn't really fit well with this module. Personally, the biggest benefit for me with Fredi is the ability to edit content from other pages - this is where AdminBar lets me down. I guess I am thinking of a way to combine the best of both somehow. I'll let you know if I have any brilliant ideas
  15. Does it work with a more standard: $items = $pages->find("limit=10, sort=-modified"); Also, what do you see if you view the page source - it might show the start of the xml so you can see the tag problem.
  16. You can read more about output formatting about half way down this page: http://processwire.com/api/variables/page/ But, in your particular situation, Soma explains it well here: http://processwire.com/talk/topic/2917-command-line-script-file-api-not-performing-same-as-on-website/?p=28697 "Image field is always an array, it's just that page output formatting does change it so in template files you get an object if the image field is set to max 1 item. So if output formatting is off it's always treated as an array, disregarding the field settings." If you have it set to false, or you have max images set to anything but '1' then you need to do one of the following: $page->column1_image->first()->url $page->column1_image->eq(3)->url $page->column1_image->last()->url
  17. Soma, correct me if I am wrong (although I tested it and it works ), but isn't that the same as doing $product->fields->product_price->label ? Is one better than the other? No worries - you should do a search and see all the stupid mistakes I have made Any luck with the number_format issue?
  18. Sorry that doesn't work. Does your original: $out .="<span>Price: </span><span>{$product->product_price}</span>"; print out the price correctly? Might be a silly question - but does your product_price field definitely have a Label defined? I checked the $product->fields->product_price->label and it works well for me. Just to be sure, can you try: $product->fields->product_price->name instead? number_format should work like that, but maybe just to test any issues with $product->product_price, try testing with something simply like "round" I see Soma lurking here too, so maybe he'll chime in
  19. Hi Piqsel and welcome! This should get you what you want: $out .="<span>".$product->fields->product_price->label.": </span><span>" . number_format($product->product_price, 0, ' ', ' ') . "</span>"; Hope that helps, and feel free to keep asking away
  20. Is there any chance that you have output formatting turned off for the page? eg $page->of(false)
  21. Hey Ryan, I don't really want to have a template for the person pages, because unless I am not understanding, this would result in search returning links to pages like: /people/joe-blogs/ The would be a page that doesn't exist within the site's menu system and would send the user to something out of context. The template for my staff vs partners is also quite different - I want quite different output I was tempted to just separate and duplicate those people that are multiple categories, but that goes against the grain and doesn't make sense. I really like the simplicity of your approach to just handle the search output differently for a specific template. Obviously much cleaner and more scalable than my approach. What I was attempting to do with that messy code above was create something portable (although I agree it probably doesn't scale very well). They way that code works is to look for any field names in the matched pages foreach($m->fields as $field) { that match page names elsewhere in the page tree $pagematches = $pages->find("name={$field->name}"); For each match where the field is checked, generate a page with the matched page name. if($pagescount>0){ foreach($pagematches as $pm){ if($m->$field!=0){ So this code can be used (I think ) to match any of these scenarios that come up, without having to define the templates that need different treatment. That said, if you couldn't understand it, then it probably isn't a good approach. I'll probably leave it as is for now since it seems to work fine, but maybe next time I come across this situation I'll take your approach instead, unless you can think of a way to clean up what I have into something that could be scalable and fully portable I still have in my mind some module that would allow the ability to define custom rules to manipulate the pagearray based on these sorts of categorizations so that all API calls were seamless. In this example, people/person would be removed from the pagarray and About > Staff > Partners > Affiliates > Partners > Contractors > would be manipulated to return the fields and data from the person template. Although as I try to describe this, it sounds pretty messy
  22. I stand corrected - good lesson for me there diogo Very true though - that is what I love about PW - the way custom PHP is so easily implemented. All the flexibility of a fully custom coded site, with all the benefits of a CMS!
  23. It sounds like you already know about the module for this: http://modules.processwire.com/modules/maintenance-mode/ I am not positive, but pretty sure this module wouldn't exist if there was an alternate way. If you're not familiar with modules yet, they are super easy to install, especially if you get the modules manager: http://modules.processwire.com/modules/modules-manager/ Once you have that, all other modules installs are just a couple of clicks and that's it
  24. Hey Marty, I think that could be a good idea too. Having images saved to a custom image field would allow a lot of flexibility, especially for allowing admin users to insert images into a RTE on another page. It seems there has been significant discussion already on the config setup, ie. largethumb,200,200,basic-page,home I fear that maybe we need to go the JSON route (as suggested earlier), if we start adding any more options. Anyone have any more recent thoughts on this?
  25. Thanks, I'll set up a pull request shortly. But for the sake of finalizing the code here too, here is the revised version which does a few more checks and other things. Hopefully my logic is sound. Also, just in case someone is interested. I am using this along with my, not yet released, PDFImageCreator module(http://processwire.com/talk/topic/3304-pdf-image-generator/). The module generates images from all the pages of a uploaded PDFs. Then I use this addition to the Thumbnails module to allow admin users to crop out a carousel/slider image from the PDF image to be used on the site's homepage. if(!$page->$prefix) { if(!wire('fields')->get($prefix)){ //If field with name matching the crop name doesn't exist, create it $f = new Field(); // create new field object $f->type = $this->modules->get("FieldtypeImage"); // get a field type $f->name = $prefix; $f->label = ucwords(str_replace('_', ' ', $prefix)); $f->description = 'This field stores user cropped images from other image fields on this page. To see new additions, you need to save this page.'; $f->save(); // save the field } //Add field to the page's template //This is separated out in case the field already exists, but is not in this template $page->template->fields->add($prefix); $page->template->fields->save(); } $page->$prefix->add($targetPath); //Add the image to the field $page->save($prefix); //If the developer sets the maxFiles value for the field to '1' and there is already an image in there, then delete the first one after adding the new one. //This seems to be necessary because the maxFiles = 1 setting doesn't limit addition of extra images via the API if(wire('fields')->get($prefix)->maxFiles==1 && count($page->$prefix) > 1){ $page->$prefix->delete($page->$prefix->first()); $page->save($prefix); }
×
×
  • Create New...