Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

6 Neutral

About SoccerGuy3

  • Rank
    Jr. Member

Recent Profile Visitors

1,157 profile views
  1. BINGO!! That was it. I had picked up some code from a (former) employee for generating the nav bar and he had used $pages as a array/var. Changed his code from $pages to $navPages and my code now works!!! Thanks for pointing me in the right direction!
  2. I've used this same code on lots of sites, but for some reason this new site is giving me grief! So with this page tree: Home Page Page Category 2nd Level Page 2nd Level Page Blog Article Article On the home page I have: foreach ($page->find("parent=/blog/, limit=3, include=all") AS $oneBlog) { echo $oneBlog->output_field; } And it works fine. But when I put that same code on a 2nd Level Page, it finds nothing and therefore the 2nd level page is blank. One other issue on this site. On all previous uses of this code I have used $pages-> instead of $page-> and it worked fine. On this site I am getting an error when using $pages: "Error: Uncaught Error: Call to a member function find() on array in /home..." Could this be a bad install of PW or something? I am missing something obvious? Help!
  3. GOT IT!! See the commented out "save" on the fourth to last line of code. That was the ticket. // Parse the CSV data $handle = fopen('data/inventorylist.csv', 'r') or die('Cannot open file.'); $prevportname = ''; while(($row = fgetcsv($handle)) !== false) { list($port_name, $port_num, $plate_num, $plate_name, $year, $price) = $row; // Get the portfolio name for this $group_name $group_item = $page->portfolio_repeater->get("port_num=$port_num"); // If no such item exists, create one if(!$group_item) { $group_item = $page->portfolio_repeater->getNewItem(); $group_item->text = $port_name; $group_item->port_num = $port_num; $group_item->save(); $page->portfolio_repeater->add($group_item); } // Create a photo item for this row $photo_item = $group_item->print_info->getNewItem(); $photo_item->title = $plate_name; $photo_item->port_name = $port_name; $photo_item->port_num = $port_num; $photo_item->plate_num = $plate_num; $photo_item->print_year = $year; $photo_item->print_price = $price; // $photo_item->save(); $group_item->print_info->add($photo_item); $group_item->save(); }
  4. Making some progress on this. Two issues: 1) It only runs through the loop once and then errors: Error: Uncaught Error: Call to a member function getNewItem() on null in /Library/WebServer/Documents/edwardscurtis/_site/site/templates/page-portfolio-import.php:27 Stack trace: #0 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/TemplateFile.php(287): require() #1 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #2 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___render', Array) #3 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #4 /Library/WebServer/Documents/edwardscurtis/_site/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) #5 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #6 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/WireHooks.p (line 27 of /Library/WebServer/Documents/edwardscurtis/_site/site/templates/page-portfolio-import.php) 2) If I put in the ->save commands in your original code, then I get this error: Error: Exception: Can’t save page 10368: /prints/large-prints/: Call $page->of(false); before getting/setting values that will be modified and saved. [portfolio_repeater] (in /Library/WebServer/Documents/edwardscurtis/_site/wire/core/PagesEditor.php line 515) #0 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Pages.php(411): ProcessWire\PagesEditor->save(Object(ProcessWire\Page), Array) #1 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Wire.php(386): ProcessWire\Pages->___save(Object(ProcessWire\Page), Array) #2 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___save', Array) #3 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'save', Array) #4 /Library/WebServer/Documents/edwardscurtis/_site/wire/core/Page.php(2409): ProcessWire\Wire->__call('save', Array) #5 /Library/WebServer/Documents/edwardscurtis/_site/site/templates/page-portfolio-import.ph Here's my current code, what am I missing? // Parse the CSV data $handle = fopen('data/inventorylist.csv', 'r') or die('Cannot open file.'); $prevportname = ''; while(($row = fgetcsv($handle)) !== false) { list($port_name, $port_num, $plate_num, $plate_name, $year, $price) = $row; // Get the portfolio name for this $group_name /* @var RepeaterPage $group_item */ $group_item = $page->portfolio_repeater->get("text=$port_name"); // If no such item exists, create one if($prevportname != $port_name) { $group_item = $page->portfolio_repeater->getNewItem(); $group_item->text = $port_name; $group_item->save(); $page->portfolio_repeater->add($group_item); $page->save(); } // Create a photo item for this row /* @var RepeaterPage $photo_item */ $photo_item = $group_item->print_info->getNewItem(); $photo_item->title = $plate_name; $photo_item->port_name = $port_name; $photo_item->port_num = $port_num; $photo_item->plate_num = $plate_num; $photo_item->print_year = $year; $photo_item->print_price = $price; // If there are more columns deal with them here $photo_item->save(); $group_item->print_info->add($photo_item); $group_item->save(); $prevportname = $port_name; }
  5. Beautiful!! I think that this is the bit that I couldn't wrap my mind around: $group_item->photos->add($photo_item); Thanks Robin!
  6. I am trying to import data to a repeating field. Searching these forums have lead me to various solutions and I think I have a decent grasp of that aspect of what I need to do. Where I am stuck is that the repeater I am importing into is actually a repeater WITHIN another repeater on a page. Looking for some help or direction to get me unstuck. Here's a sample of what I am working with (simplified): Large Images (page) Group Name (Repeater) Photo (Repeater) Image (um, image field) Image Name (text) Price (text) Data looks like (one row): Group, image name, price So the big question is how to create the outer repeater and then the sub-repeaters. Can it be done? I could manually create the outer repeaters (there are only like 10-15 of them) if that makes it easier, but then, how to address the repeater inside for the import? Any suggestions (or code samples) welcome. Thanks in advance, Marc
  7. Update: Appears to be browser specific. Mac Chrome: Grid only, no details Mac FF: Everything prints.
  8. My client wants to print the page with the Calendar Grid. When you print, the grid prints, but not the individual items. Anyone run across this?
  9. @joshuag - Sent you a PM followup to the open issue and an additional question...
  10. @adrian - Tried the refresh. Tried changing permissions and ownership at the command line for the site on the local machine. Nothing works. Frustrating, but moving on. It works on the server that's all that matters (at least for now - hopefully won't break when I move it to the live server!).
  11. @adrian - Thank you for your offer to help.... You know there are days I really like programming, then there are other days! This is one of those others. I moved the site from my local machine to our dev server so I could give you access. Guess what? When I did that the extra fields for language URL showed up!! Thanks again. Looks like we are all good now.
  12. @AndZyk and @adrian thanks for getting back to me. Yes to both your questions. I have added a second language, Spanish, and can see the option in Admin to switch between Default and Spanish. I have even tested this and see the entire admin in Spanish. I can see the alternate language fields in the individual pages in the admin (actually have already populated them). The one piece that I am missing is the ability to switch languages in the front end. The docs say there should be a place to enter the second language URL piece (see screenshot attached): http://domain.com/es/ I cannot find that. It appears that it didn't get installed or isn't working as the docs say it should. Or I am looking in the wrong spot.
  13. Running the latest PW install. Installed all 4 Language modules and the language pack for Spanish. I can change my default language and see all the labels in the admin change to spanish. But when I go to ANY page in the tree, I see only a single URL field (default). I do not see the additional field to enter the "/es/" into. From the docs (what I don't see): Any suggestions on where to look?
  14. No. Tried: template, original, rrule, month. All with the same result, that is nothing was output.
  • Create New...