0
Welcome Guest! Login
0 items Join Now

Adding code to the <?php of a specific page

    • WillRoz's Avatar
    • WillRoz
    • Rocketeer
    • Posts: 55
    • Thanks: 0
    • Developer

    Adding code to the <?php of a specific page

    Posted 11 years 4 months ago
    • Hi,

      I need to add the following to the <?php, but only on a particular page on my site:
      $user = JFactory::getUser();
      $user->load($user->get('id'));
       
      $session = JFactory::getSession();
      $session->set('user', $user);
      $user = JFactory::getUser();

      I need to do this because on this page the user credentials need to be refreshed after being changed.

      The page in question has the url:
      /welcome-to-the-directory

      I duplicated the 'Master' style and assigned it to that page, but didn't see any place that made sense to add the code to. How do I go about doing this?

      Joomla 3.1.5
      Gantry 4.1.18

      Thanks,
      Will
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13484
    • Web Designer/Developer

    Re: Adding code to the <?php of a specific page

    Posted 11 years 4 months ago
    • 1. install "sourcerer" from Nonumber
      2. create a custom HTML module and assign it to the page in question. In there, encapsulate your php code in sourcerer tags.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.

Time to create page: 0.057 seconds