SHARE
TWEET

HelloWorldDrupalModuleQuestion

a guest Feb 27th, 2016 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * @file
  4.  * @author Rakesh James (Modified by JP)
  5.  * Contains \Drupal\example\Controller\ExampleController.
  6.  * Please place this file under your example(module_root_folder)/src/Controller/
  7.  */
  8. namespace Drupal\example\Controller;
  9. /**
  10.  * Provides route responses for the Example module.
  11.  */
  12. class ExampleController
  13. {
  14.   /**
  15.    * Returns a simple page.
  16.    *
  17.    * @return array
  18.    *   A simple renderable array.
  19.    */
  20.   public function myPage()
  21.   {
  22.     $toPage = " ";
  23.     $group  = "";
  24.    
  25.     db_set_active('001');
  26.  
  27.     $result = db_query("SELECT * FROM fav_links join fav_links_grp1 on flg1_code = fl_grp order by fl_grp");
  28.  
  29.     foreach ($result as $record)
  30.     {
  31.       if ($group <> $record->fl_grp)
  32.       {
  33.         $toPage = "$toPage<br><b>$record->flg1_name</b>";
  34.       }
  35.       $toPage = "$toPage<br><a href=\"$record->fl_url\">$record->fl_name</a>";
  36.       $group=$record->fl_grp;
  37.     }
  38.  
  39.     db_set_active();
  40.      
  41.     $element = array(
  42.       '#markup' => t($toPage),
  43.     );
  44.     return $element;
  45.   }
  46. }
  47. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top