Jump to content

Where did you installed WHMCS?


ChrisTERiS

Where did you installed WHMCS?  

10 members have voted

  1. 1. Where did you installed WHMCS?

    • Domain root
      4
    • Subdirectory
      5
    • Subdomain
      1


Recommended Posts

Subdirectory.
I prefer having a site with content outside of WHMCS, and sending interested parties into WHMCS to order. I find I have a lot more freedom to manage the content that way, not to mention the ability to not be locked into WHMCS should "something" happen in the future preventing it's use. 

Link to comment
Share on other sites

2 hours ago, Kian said:

Root directory. I managed to get rid of third-party CMS like WordPress a long time ago. I'm using WHMCS for everything.

Correct. I believe that CMS is the only reason that most Admins decide to install it in other than root directory.

Actually, my opinion is that, if index.php was not encoded and thus editable, should be easy to use a semi CMS there.

Link to comment
Share on other sites

20 minutes ago, ChrisTERiS said:

Correct. I believe that CMS is the only reason that most Admins decide to install it in other than root directory.

Exactly.

20 minutes ago, ChrisTERiS said:

Actually, my opinion is that, if index.php was not encoded and thus editable, should be easy to use a semi CMS there.

It's quite the opposite. You need index.php "as it is" to add CMS functionalities:

  • index.php?m=YOUR_CMS_MODULE&view=news becomes /news
  • index.php?m=YOUR_CMS_MODULE&view=blog&id=112 becomes /blog/112/I-hate-myself

Without index.php you can't use WHMCS framework (eg. Smarty, database connection, data, login, settings...). Editing index.php is not necessary. It's your best friend.

Link to comment
Share on other sites

44 minutes ago, Kian said:

Exactly.

It's quite the opposite. You need index.php "as it is" to add CMS functionalities:

  • index.php?m=YOUR_CMS_MODULE&view=news becomes /news
  • index.php?m=YOUR_CMS_MODULE&view=blog&id=112 becomes /blog/112/I-hate-myself

Without index.php you can't use WHMCS framework (eg. Smarty, database connection, data, login, settings...). Editing index.php is not necessary. It's your best friend.

To be honest, never tried to examine how index.php works. At least back to 2007, I don't think that it was working like this.

Thank you for this important information.

Link to comment
Share on other sites

46 minutes ago, Kian said:

Exactly.

It's quite the opposite. You need index.php "as it is" to add CMS functionalities:

  • index.php?m=YOUR_CMS_MODULE&view=news becomes /news
  • index.php?m=YOUR_CMS_MODULE&view=blog&id=112 becomes /blog/112/I-hate-myself

Without index.php you can't use WHMCS framework (eg. Smarty, database connection, data, login, settings...). Editing index.php is not necessary. It's your best friend.

Even if I post it in another thread, as I didn't got any reply for 3 days now, can I ask you something?

Let's say that I've  a  module "forums" and I want it to be the homepage of my site (whmcs homepage). Is it possible and how I can do it?

Link to comment
Share on other sites

If I understand you correctly, you can do that with .htaccess. At the moment I haven't forums for WHMCS but the principle is the same:

RewriteRule ^$ ./cart.php?a=add&domain=transfer [L]

Here's the result (click to zoom). As you can see I'm using Transfer Domain page as my index. You can do the same for any page you want including ones powered by third-party modules.

sample-453.thumb.png.29961b014074f38575935484298c0018.png

Let's suppose you create an addon module that implements forums in WHMCS.  Addon modules return data in YOURMODULE_clientarea() function as follows.

<?php

if (!defined("WHMCS"))
	die("This file cannot be accessed directly");

function YOURMODULE_config()
{

}

function YOURMODULE_activate()
{

}

function YOURMODULE_deactivate()
{

}

function YOURMODULE_upgrade()
{

}

function YOURMODULE_output()
{
    // WHMCS backend
}

function YOURMODULE_clientarea()
{
    // WHMCS frontend
  
    if ($_GET['view'] == 'thread')
    {
      // Return data for "thread-view"
    }
  	elseif ($_GET['view'] == 'board')
    {
      // Return data for "board-view"
    }
    elseif ($_GET['view'] == 'post')
    {
      // Return data for "post-view"
    }
    else
    {
      // Return data for "forums-homepage"
    }
}

You can access to all your _clientarea() sections (thread, post, board, home) from the following URLs:

  • index.php?m=YOURMODULE&view=thread
  • index.php?m=YOURMODULE&view=board
  • index.php?m=YOURMODULE&view=post
  • index.php?m=YOURMODULE

In other words, the home of your forums is index.php?m=YOURMODULE. This URL is not memorable so you can use .htaccess to make it accessible from /forums.

RewriteRule ^forums$ ./index.php?m=YOURMODULE [L,NC]

This way example.com/forums opens your forums home. If you want to replace WHMCS home page with your forums, you can change the .htaccess as follows.

RewriteRule ^$ ./index.php?m=YOURMODULE [L,NC]

p.s. To avoid having duplicate content, you also need an additional rule to redirect visitors from example.com/index.php to example.com/.

p.p.s. I don't get why why this f-o-r-u-m keeps replacing F-O-R-U-M with COMMUNITY 🤬

----------------------------------------

You could also use a different and more flexible approach by implementing "widgets". Don't get me wrong, this is not related to WHMCS widgets. Of course this is not something you could use for forums but works fine for "small" things like news, blog posts etc.

I use ClientAreaPage to create an additional template variable that is available in all WHMCS pages. To avoid naming collissions, I use to call such variable like $MYMODULENAME. The variable contains all data related to say news and blogs posts (eg. title, URL, excerpt, featured image, date, author...). I can access to news array via $MYMODULENAME.news. Similarly $MYMODULENAME.blog has all posts.

Next I create small Smarty templates that loop through array to create the actual widget (eg. last 5 news, top posts, random news etc.). Now I can create pretty complex pages by simply calling widgets wherever I want in WHMCS pages. For example here's how you can display last 5 news & randomly selected posts in your homepage.tpl.

<div class="row">
	<div class="col-md-6">
		{include file="modules/addons/YOURMODULE/templates/Widget.tpl" widget=news show=5}
	</div>
        <div class="col-md-6">
		{include file="modules/addons/YOURMODULE/templates/Widget.tpl" widget=blog show=5 random=true}
	</div>
</div>

If like me you don't like to use parameters (eg. show=5) you can make it customizable from the backend of your module with sliders and on/off toggles.

Edited by Kian
Link to comment
Share on other sites

@Kian

Only one "Thank you" as reaction is not enough to show my appreciation for your help. As English is not my tongue language, need to read it a couple of times again to get the full meaning, but really I'm grateful for the time that you spent to write all this.

 

Edited by ChrisTERiS
Link to comment
Share on other sites

On 12/4/2020 at 9:42 PM, bear said:

Subdirectory.
I prefer having a site with content outside of WHMCS, and sending interested parties into WHMCS to order. I find I have a lot more freedom to manage the content that way, not to mention the ability to not be locked into WHMCS should "something" happen in the future preventing it's use. 

My thoughts too exactly.

Link to comment
Share on other sites

  • 2 months later...
On 12/5/2020 at 5:59 PM, WHMUp said:

@Kian

Only one "Thank you" as reaction is not enough to show my appreciation for your help.

 

I'm glad Kian was able to help you. Unfortunatly, it seems he only supports the people who aren't actually his clients.

Those of us who spent money on his software are left wondering if he will ever reply to our tickets 😕

It's kind of funny, really... When I've asked him why he doesn't reply to tickets, he often complains that he has no time because he is busy helping people on these forums with general WHMCS issues or helping support other products. I just wish he showed the same enthusiasm for supporting his own clients.

Link to comment
Share on other sites

On 12/4/2020 at 10:42 AM, bear said:

Subdirectory.
I prefer having a site with content outside of WHMCS, and sending interested parties into WHMCS to order. I find I have a lot more freedom to manage the content that way, not to mention the ability to not be locked into WHMCS should "something" happen in the future preventing it's use. 

This, also using subdirectory, there are pros and cons to every situation. I prefer to keep WHMCS out of my main website since its so limited when it comes to customization and coding.

Link to comment
Share on other sites

On 12/4/2020 at 12:04 PM, WHMUp said:

Correct. I believe that CMS is the only reason that most Admins decide to install it in other than root directory.

Actually, my opinion is that, if index.php was not encoded and thus editable, should be easy to use a semi CMS there.

Agree, but its encoded, and not only index.php but many other parts in WHMCS are encoded. The themes or smarty .tpl files are getting more and more useless as they remove code from templates and put them behind iconcube files which make editing and design impossible in some cases if you don't have a hook available.

Link to comment
Share on other sites

On 12/4/2020 at 12:35 PM, Kian said:

Exactly.

It's quite the opposite. You need index.php "as it is" to add CMS functionalities:

  • index.php?m=YOUR_CMS_MODULE&view=news becomes /news
  • index.php?m=YOUR_CMS_MODULE&view=blog&id=112 becomes /blog/112/I-hate-myself

Without index.php you can't use WHMCS framework (eg. Smarty, database connection, data, login, settings...). Editing index.php is not necessary. It's your best friend.

I think his point is that if the index.php was open, you could integrate with any other index.php that also does routing.

Link to comment
Share on other sites

Here are the main situations:

 As root domain

example.com

WHMCS now becomes your whole site. Not something most people want since building your whole site around WHMCS is next to impossible as the code is not open. Most companies and users would prefer to use their own CMS or files for the main site and leave WHMCS isolated, this also avoids potential issues and bugs with your main site or other software.

Subdirectory

WHMCS runs on its own directly which makes it more simple to manage, all files in that folder are only for WHMCS.

Subdomain

People go with this choice if they run WHMCS in another server separated from the rest of the site like forums, blogs, etc. This is actually suggested, to run WHMCS in a complete separate server, except you don't need a subdomain for this either...

example.com/whmcs

That can very much be a completely different server, assuming you use a load balancer it makes no difference to use whmcs.example.com or example.com/whmcs since load balancer can route to a different server this way. But, the simple away is just create a new subdomain with a different A record that points to a different server.

The main drawback about the subdomain option is that if you integrated WHMCS in your main site, you are not making twice the DNS requests for every page. Assuming you are loading the images, CSS, etc from example.com for whmcs.example.com, browsers consider subdomain.example.com as a separate domain, you will make an extra DNS request and it also not cache elements from example.com, which means someone jumping from example.com to whmcs.example.com is now loading everything again, this is twice the bandwidth and for first time visitors, they will load slower than opposed to using a subdirectory.

You can also have issues with fonts, and JS related to cross origin resource sharing, while that can be solved in a simple way to authorize the main domain, its still something to consider since cookies, javascript and others will be considered as loaded from a different domain name.

In the end, the best approach depends on what you are doing and how your site is setup. What ever you do, do not put everything in the same box. If you are running a blog, a community or other softwares, don't put WHMCS with them. WHMCS does billing and as such is more sensitive than other software. You don't have your billing and customers compromised because you forgot to update WordPress in the same server. Run WHMCS on a different Linux account with its own permission or better, run it on a completely different server for privacy and security.

Edited by yggdrasil
Link to comment
Share on other sites

On 12/4/2020 at 3:04 PM, WHMUp said:

Actually, my opinion is that, if index.php was not encoded and thus editable, should be easy to use a semi CMS there.

index.php is literally just something that inits WHMCS and fires requests at the frontend dispatcher before passing the response to a Zend Framework (or Laminas in v8+) SAPI emitter.  4 or 5 lines of code + some error handling? 

But why? WHMCS's UI is not pretty and historically has been out of step with modern web development (eg. it's only just gone to Bootstrap v4). It's not really great for the marketing part of a business. 

 

Link to comment
Share on other sites

1 hour ago, aegisdesign said:

index.php is literally just something that inits WHMCS and fires requests at the frontend dispatcher before passing the response to a Zend Framework (or Laminas in v8+) SAPI emitter.  4 or 5 lines of code + some error handling? 

But why? WHMCS's UI is not pretty and historically has been out of step with modern web development (eg. it's only just gone to Bootstrap v4). It's not really great for the marketing part of a business. 

 

I don't actually care about the UI as long as its 100% customizable. I actually prefer it to be simple and just let WHMCS users customize and adapt it to their designs. In a perfect world, you would be able to use what ever UI framework you like but bootstrap is so heavily integrated with WHMCS features, that there is no other choice than using what they support.

Link to comment
Share on other sites

I prefer subdomains rather then sub directories as it keeps the setup easy to separate either by server or by just the system user without specific routing needs.   The only time I would use sub directories is when trying to replicate the same setup of sub domains where they can be on separate servers or separate system users but that requires at the least nginx routing each location to a different php pool.   If using sub directories without separation like this, you're just inviting cross script attacks. 

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