⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

variable available in template identifying current function?



ssfthurber

ssfthurber
  • profile picture
  • Member

Posted 12 June 2013 - 12:58 PM

does anyone know if there is a variable that template view php script can see and use to determine what crud function is being executed (ex: add, edit, etc.)?


ssfthurber

ssfthurber
  • profile picture
  • Member

Posted 12 June 2013 - 13:55 PM

update

i'm just trying to hide a mainMenu element on the edit screen.

obviously i can use the approach coded below but wondering if there is a cleaner way than this somewhat messy technique:

 

   $output.='<script> if (validation_url!="") $(".mainMenu").hide(); </script>'; 

davidoster

davidoster
  • profile picture
  • Member

Posted 12 June 2013 - 14:41 PM

Use the getState to determine from the controller the state you are on.

After that depending on the way your project is structured you can change the display of the menu from the controller itself or via passing some variable on the view and checking there.

Myself I prefer to handle stuff like menu alteration, breadcrumbs and use access from the controller and amend the outputed data accordingly.


ssfthurber

ssfthurber
  • profile picture
  • Member

Posted 12 June 2013 - 18:26 PM

sure. 

i've avoided using getState because of the empty doco page for getStateInfo 


davidoster

davidoster
  • profile picture
  • Member

Posted 13 June 2013 - 07:43 AM

You don't need to do anything with the getStateInfo actually!!!