WHMUp 10 Posted December 4, 2020 It's interesting to know where you've installed WHMCS in your site and if possible to share the reason that you choose to install it there. For example, I'm always installing it to the root directory even if I've some limitations to modify the interface of the homepage. 0 Quote Share this post Link to post Share on other sites
Kian 316 Posted December 4, 2020 Root directory. I managed to get rid of third-party CMS like WordPress a long time ago. I'm using WHMCS for everything. 1 Quote Share this post Link to post Share on other sites
bear 92 Posted December 4, 2020 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. 1 Quote Share this post Link to post Share on other sites
WHMUp 10 Posted December 4, 2020 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. 0 Quote Share this post Link to post Share on other sites
Kian 316 Posted December 4, 2020 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. 1 Quote Share this post Link to post Share on other sites
WHMUp 10 Posted December 4, 2020 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. 0 Quote Share this post Link to post Share on other sites
WHMUp 10 Posted December 4, 2020 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? 0 Quote Share this post Link to post Share on other sites
Kian 316 Posted December 4, 2020 (edited) 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. 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 December 4, 2020 by Kian 1 Quote Share this post Link to post Share on other sites
WHMUp 10 Posted December 5, 2020 (edited) @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 December 5, 2020 by ChrisTERiS 0 Quote Share this post Link to post Share on other sites
Magicklug 1 Posted December 11, 2020 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. 0 Quote Share this post Link to post Share on other sites
Ithiel 3 Posted February 19 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. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted February 19 On 12/4/2020 at 9:32 AM, 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. That must be tough, to use WHMCS for your whole website. As a designer/developer I would never use something closed source for my main site. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted February 19 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. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted February 19 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. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted February 19 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. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted February 19 (edited) 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 February 19 by yggdrasil 0 Quote Share this post Link to post Share on other sites
aegisdesign 8 Posted Wednesday at 12:26 PM 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. 0 Quote Share this post Link to post Share on other sites
yggdrasil 80 Posted Wednesday at 01:37 PM 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. 0 Quote Share this post Link to post Share on other sites
steven99 85 Posted Thursday at 10:55 PM 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. 0 Quote Share this post Link to post Share on other sites