Jump to content

jsantari

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by jsantari

  1. Thanks Macrura - you got back to me just as I was editing my last post. Please refer to it to see my oversight.
  2. Was looking at the data in the db and realized what I was overlooking so now I can admit to making a dumb mistake in my testing - I moved my code to a testing only page template and forgot that I was now referencing from a different page! Classic couldn't see the forest for the trees. It's working as expected and I must admit is slick. thanks to all for their feedback.
  3. Wouldn't expect there to be any issue in assigning to a variable first. Tried your suggestion though to see and get the same results.
  4. Ok I've simplified things as suggested. I've added two repeater (widget) items to my page. Tried some more code and still have several problems. First one is that this code only retrieves the first item. My count comes back as 1 not 2. $group = $page->widget_group; echo 'There are [ '.count($group).' ] widgets assigned<hr>'; I also have problems with getting the right data back inside my loop. Here is that code. foreach ($group as $item) { echo 'Widget Title: '.$item->widget_group_name->title.'<br>'; // OK echo 'Widget block content: '.$item->widget_group_name->block.'<br>'; // OK echo 'Widget access: '.$item->on_device.'<br>'; // WRONG DATA RETURNED echo 'Placement position: '.$item->widget_group_position.'<hr>'; // WRONG DATA RETURNED } Here is the output: Widget Title: My First Block Widget block content: This is my first widget block content Widget access: 8 Placement position: left Widget Title and Widget block content are correct. Widget access returns a number 8, that input in the repeater is a select list that I created and the value that is currently selected should be 16. Placement position is a text input in the repeater with a current value of 'sidebar', as you can see it shows 'left'. No idea where it is getting either of these values from. Having a hard time getting my head around how PW does things which is frustrating but I can see the great potential that it has.
  5. I've attached the array dump in a text file.group_array.txt
  6. I get a large array with the first element being the RepeaterPage object.
  7. What should I get when I print_r($group) ? It dumps out a huge RepeaterPageArray object. Doing $item I get RepeaterPage object.
  8. Tried your code but get no output at all in the list. Why is the using just widget 'optimal'?
  9. Ok, then if I understand this I need to get the page of the widget using the id. Tried that but it doesn't work for me? $group = $page->widget_group; foreach ($group as $item) { echo $item->widget_group_name.'<br>'; // this works as I see the id# $widget_page = $pages->get($item->widget_group_name).'<br>'; // get the page using the id - doesn't appear to work? echo $widget_page->block.'<br>'; // Shows me nothing - (block is the name of a field on the widget page) }
  10. Hi 2nd day into PW and I think its great! I've setup a template with a repeater for widgets (things I want to load into the page). I've setup a field called widget_group_name which is type page with a radio input so I can pick one of my widgets. I also have another field in the group called widget_group_position which is just a text input. There are two items in the group on the current page. I use this code to access the repeater field and here is what comes back. $group = $page->widget_group; foreach ($group as $item) { echo $item->widget_group_name.'<br>'; } I get this output for widget_group_name: 1012|1013 1012 It works correctly if I use widget_group_position in the loop above and displays the text value.
  11. Hi, I'm working for the first time with PW (though I am an experienced web/php developer) is there a way to set this up so that children can only be created below the top level parent?
×
×
  • Create New...