vanny

you may need to push and array to the page with the data you need

Jerome Camacho

public function getServicesPage(){

  return ServicesPage::get()->sort('IconOrdering','ASC')->limit($count);

}

how can i push some attribute with data on ServicesPage object , i mean i want to customise the data before i <% loop %> it on the template?

Joe

the html would be in the template still

it’s hard for me to provide a good example without any context, but if you’re trying to check a few things to decide whether or not to render something in the template, I find that moving those checks to the controller keeps the template cleaner

so you might have a controller function like:

  1. public function ShowSection() {
  2. if ($this && $that) {
  3. return true;
  4. }
  5.  
  6. return false;
  7. }

then in the template you might have:

  1. <div>
  2. <% if $ShowSection %>
  3. <div>Stuff goes here</div>
  4. <% end_if %>
  5. </div>
Jerome Camacho

how about the html tags this can be render too in controller and if i call the variable in template, this can be output correctly ?

Joe

personally i’d do that check in the controller rather than the template. separation of concerns.

Jerome Camacho

how to check if the string have 2 words in template(.ss) file

vanny

whats the php code to get the site base link. not page, entire site

wmk

in SS4 all those chineese locales should be available. If you have a dropdown somewhere, I'd filter this by allowed locales.