Jump to content

order form q


Adamski

Recommended Posts

  • WHMCS CEO

With the use of the appropriate code in the template files this would be possible. You'd need to pass in a variable telling the system which style it should use and then use an if statement in the templates to check this variable and display the header/footer accordingly.

Link to comment
Share on other sites

  • 3 weeks later...

Can anyone help me with this ;)

 

I was thinking that the best way was to pass something like "template=blue_template" at the end of the logon url (I have a login form on my domain) and then check if $_REQUEST[template] exists and if it does save it in a SESSION variable...

 

But I have no idea how to actually do it. Can someone point me in the right direction or where there may be some good examples?

 

Matt you may want to move this to Customisation and Intergration.

 

Thanks all

 

Ad

Link to comment
Share on other sites

  • WHMCS CEO

Ok, I haven't tested this but I think it would need to be done something like this.

 

In header.tpl, add a PHP code block at the top:

 

{php}
if ($_GET["template"]) {
$_SESSION["template"] = $_GET["template"];
}
{/php}

 

Then you would use code such as the following:

 

{if $smarty.session.template eq "blue_template"}
Display this HTML code here
{else}
Display this HTML code here
{/if}

 

You would probably need to use the above code in both your header and footer template files to modify these sections to fit the selected template.

 

Hope that helps!

 

Matt

Link to comment
Share on other sites

ok I have done that but all that displays is the default theme. Now this is likely to be down to me so this is what I have so far

 


{php} 
if ($_GET["template"]) { 
$_SESSION["template"] = $_GET["template"]; 
} 
{/php}

{if $smarty.session.template eq "onestopdigital"} 
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>{$companyname} - {$pagetitle}</title>

<link rel="stylesheet" type="text/css" href="templates/onestopdigital/style.css" />
</head>

<body>
<table id="wrapper" align="center">
 <tr>

etc etc etc ...

{else} 
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>{$companyname} - {$pagetitle}</title>

<link rel="stylesheet" type="text/css" href="templates/default/style.css" />
</head>

<body>

etc etc etc 

{/if}

 

Do I need to sepecify the template path as I have done in the css line? Have I put everything in the right place?

 

Thanks :)

 

Ad

Link to comment
Share on other sites

it just displays the default theme as per the {else} tag .. that bit is working as I have my onestopdigital theme set to be used in control panel. I just can't work out why it doesn't do the first bit!

 

My login passes "&template=onestopdigital" at the end of the string so all the names are correct. I will have to sit and stare and work it out lol

Link to comment
Share on other sites

Ok if I add ?template=onestopdigital to the end of the url in the address bar it all works. My login form is one form for several control panels, which then goes through a script to redirect to the appropriate panel depending on which has been selected.

 

switch ( $_REQUEST['controlpanel'] ) {
   case 'billing':
       $url = "http://www.domain.co.uk/client/dologin.php?template=onestopdigital&username={$_REQUEST['username']}&password={$_REQUEST['password']}";
       break;

 

When I type it into the address bar with ..co.uk/client/clientarea.php?template=onestopdigital - all ok

 

but .co.uk/client/dologin.php?template=onestopdigital - doesn't like

 

Ad

Link to comment
Share on other sites

[rant]which defeats the object of having my own logon. I have 5 different control panels and they can't all be seperate pages it looks very unprofressional. why can't it be done this way?[/rant]

 

ok i have had a thought - if i pass the variables to login page I should be able to play with the login.tpl .. ok that probably makes no sense. I'll play and report back :)

Link to comment
Share on other sites

UPDATE - all sorted and working :)

 

I changed my redirect code from this:

 

switch ( $_REQUEST['controlpanel'] ) { 
   case 'billing': 
       $url = "http://www.domain.co.uk/client/dologin.php?template=onestopdigital&username={$_REQUEST['username']}&password={$_REQUEST['password']}";
       break; 

 

to this:

 

switch ( $_REQUEST['controlpanel'] ) { 
   case 'billing': 
       $url = "http://www.domain.co.uk/client/dologin.php?goto=clienteare&template=onestopdigital&username={$_REQUEST['username']}&password={$_REQUEST['password']}";
       break; 

 

it's always something simple that gets me stuck! Hopefully this might help someone else!

 

Thanks for you help Matt - and aplogies for my rant.. I've spent hours doing something that took seconds in the end.

 

Ad :)

Link to comment
Share on other sites

Interesting, maybe this will help me too. I tried to have a little login form in Joomla which should call the WHMCS dologin page in the wrapper iframe and automatically login. I did not figure out how pass on the login data. Maybe your solution works for me too.

 

I'll give it a try.

Thanks

Link to comment
Share on other sites

ok I've run into a stumble.. so overwhelmed in joy was I that I could log in I didnt realise that my browser was caching the template so that bit isn't working. I'm using the above code still but it is loading the default template everytime. Again if I mainly add ?template=onestopdigital to the end of the url it's ok.

 

Any suggestions?

 

Cheers

 

Adam

Link to comment
Share on other sites

This should do it:

 

<?php 
$this_domain = $_SERVER['HTTP_HOST'];

if ( $this_domain == yourdomain1.com ) {
echo "HTML 4 your first domain's theme";
} else {
echo "HTML 4 your second domain's theme";
}
?>

 

It took me a whole smoke to remember that one. Thanks for the refresher. Let me know if you have problems. Oh, and you don't have to code it that way, "$_SERVER['HTTP_HOST']" is all you needed.

Link to comment
Share on other sites

Just loading the default template which is what I have specified for else.

 

As it's in the header.tpl file I've smartied it - I think it is right:

 

{php} 
$this_domain = $_SERVER['HTTP_HOST']; 
{/php}

{if $this_domain == "http://www.domain.co.uk"}
<html>
<head>

 

I've tried the domain with/without http and https and with/withouth www etcetc

Any more ideas? Thanks Adam

Link to comment
Share on other sites

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