View more context

 

muskie9

true, I'm not 100% but I think there's some magic w/the routing that then serves up the DO's form admin/model-admin-segment/MyModel/EditForm/field/MyModel/item/13/edit would be the getCMSFields of the MyModel class and serve up the data for record #13... so if you can get to that record from the base getList you should be able to save and have it update the record

muskie9

I've been digging but can't pinpoint if that's truely the case... gridfield and model admin are still a lil out there for me... I've done some basics w/it but what your running into I haven't seen before 😬

Mansi

I'm thinking of saving the URL params to a Session variable and then using that for filtering the getList().

muskie9

I guess you could do that... just seems odd you'd have to do that... have you tried w/SS 3.7? maybe if that was an issue it was patched

Mansi

Can't. Massive project with a lot of other dependencies...

muskie9

maybe try the session then... tough spot for sure... once you start setting session vars you'll have extra things to check for and what not

customPhpDev

Is there any way to define a variable in the template file? I want to make my code condition base. i.e. <% if($ClassName == "HomePage") %> <%-- define variable here and I can use it in other HTML element --%> <% end_if %>

MichalKleiner

I can imagine that being possible through global template method, tapping into the current controller and storing the value there… then it might be available in the next blog, in theory, but would need testing… ss templates are not designed to handle dynamic code in that way

wmk

@customPhpDev that belongs to your PageController. I'd make a helper method with a descriptive name and make a getter for that Variable.

  1. public function doSomething() {
  2. return $this instance of HomePage_Controller;
  3. };
  4.  
  5. public function getMyVariable() {
  6. return $this->doSomething()
  7. ? 'value'
  8. : null;
  9. }