Jump to content

Passing a variable to the tpl files


UmbraHosting

Recommended Posts

Hey Everyone,

 

I created a custom variable for our dedicated server package under

 

Products & Services >> Edit Product >> Custom Fields

 

The custom field I created was "switchport" and I propogated all of the fields for the dedicated server packages with their appropriate switch port.

 

Then, I created a new PHP file within the root WHMCS directory called "bandwidth.php" which contains this code:

 

<?php

define("CLIENTAREA",true);

require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$pagetitle = $_LANG['clientareatitle'];
$pageicon = "images/support/clientarea.gif";
$breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>';
$breadcrumbnav .= ' > <a href="bandwidth.php">Bandwidth Graphs</a>';

initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav);

if ($_SESSION['uid']) {
 # User is Logged In - put any code you like here
}

# To assign variables in Smarty use the following syntax.
# This can then be used as {$variablename} in the template

$smartyvalues["variablename"] = $value;

# Define the template filename to be used without the .tpl extension

$templatefile = "bandwidth";

outputClientArea($templatefile);

?>

 

I then created the /templates/integration/billing.tpl file and this is where I'm stuck. I would like to include the *.png files for my clients which reside within an MRTG directory.

 

The img tag I would like to use is:

 

<img src="http://www.domain.com/billing/mrtg/image_XX.png

 

(Where XX is the switchport number I specified in the custom service variable field)

 

I'm sure that I'm missing something obvious, but how do I call the variable within the bandwidth.tpl file to include it in the URL to the image file?

 

Thanks for your time!

 

-Tom

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated