growe Posted February 22, 2009 Share Posted February 22, 2009 As you probably already know, the wonderful WHMCS team have already made a change to allow for SEO friendly URLs in the knowledgebase. That is awesome and is very needed for SEO but since they have already included that as an official upgrade, I won't talk much about it here. What I will talk about is a way for you to have specific customized header and meta tags for each page. I have seen some methods used with "if" statements in the header.tpl but only so much can be done with that method. For example, it is very hard to have a customized "keywords" meta tag with that method. What I propose is having the header.tpl called by individual templates rather than WHMCS itself. By doing it this way, each template can feed header.tpl with some customized info. So here is how it is done: (Easy as 1-2-3 .... Only three simple steps) 1) First, we need to disable WHMCS from automatically loading the header.tpl - Maybe in a future update they'll have that has a config setting so that we can decide if we want WHMCS to load it or not. - Since that option has not yet been added, we have to trick WHMCS.... Copy the contents of header.tpl into a new file and call it custom_header.tpl - Now delete everything from header.tpl so it is just a blank file. WHMCS will still load it but since it is empty, nothing will happen. 2) Edit custom_header.tpl which you just created to include your custom header and meta tags. Each tag should specify both a variable that each template can set and a default value in case a template does not set the value. Example: <html> <head> <title>{$title|default:'$companyname - $pagetitle'}</title> <meta name="description" content="{$meta_description|default:'Some default text here'}" /> <meta name="abstract" content="{$meta_abstract|default:'Some default text here'}" /> <meta name="keywords" content="{$meta_keywords|default:'Some default text here'}" /> <meta name="author" content="{$meta_author|default:'Joe Author'}" /> <meta name="rating" content="{$meta_rating|default:'General'}" /> <meta name="revisit-after" content="{$meta_revisit|default:'15 days'}" /> <meta name="robots" content="{$meta_robots|default:'index,follow'}" /> </head> <body> 3) At the top of every template file, load the custom_header.tpl file by including something like the following (obviously customized to the needs of each template).... {* When calling the custom_header.tpl file, only specify whatever values that change from the defaults set in custom_header.tpl *} {include file='custom_header.tpl' meta_description='Page specific description here' meta_keywords='Page specific keywords here' meta_robots='noindex,nofollow'} 0 Quote Link to comment Share on other sites More sharing options...
Shaun Posted February 22, 2009 Share Posted February 22, 2009 Very Well Done. 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 22, 2009 Author Share Posted February 22, 2009 Thanks. If you have any other ideas on how to enhance it more... post it here. I'm trying to get my site fully SEO. Any other ideas are fully appreciated. Cheers, g 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 22, 2009 Share Posted February 22, 2009 Hi G, Interesting thoughts. Definitely a topic that needs more input and development. I started a thread in the WIKI about this very topic. http://wiki.whmcs.com/Seo Obviously there is much that could be done to improve SEO in WHMCS. Can you add your content about what currently you believe is currently possible? Cheers, Dan 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 22, 2009 Author Share Posted February 22, 2009 Definitely... will do it now. g 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 22, 2009 Share Posted February 22, 2009 (edited) re your original post (I'm not a coder by the way), there might be a another way to do what you suggest. Because WHMCS isn't a dynamic CMS, the challenge is that data that can be used for SEO purposes is held in different methods So to consilodate that information, would it be possible in the header.tpl to call a php file that populates the variables you stated? In that file you could then attach variables like page title etc to the $meta variables and others. Obviously there are other variables that are page specific, such as KB/DL/Annouce category, title Rather than if statements, calling variables from an array based on the page name/type might be useful. feel free to continue my train of thought. Edited February 22, 2009 by Zorro67 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 22, 2009 Author Share Posted February 22, 2009 would it be possible in the header.tpl to call a php file that populates the variables you stated? In that file you could then attach variables like page title etc to the $meta variables and others. Might be possible but not sure how because then your asking the header.tpl to go get the data instead of having the other templates feed the header.tpl with the data. Maybe someone with more coding experience would have a more intelligent response. g 0 Quote Link to comment Share on other sites More sharing options...
Shaun Posted February 23, 2009 Share Posted February 23, 2009 Inside the headerr.tpl import a php page called seo.php. In there have an array with Zorro is meansing. TBH i think that they orignal way is just as managable. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 23, 2009 Share Posted February 23, 2009 (edited) Maybe someone with more coding experience would have a more intelligent response. EXCUSE ME? Listen "Mr 11 Posts". You might want to be careful about making assumptions or blatant insults before posting your answers I never said i didn't have any coding experience - just that I was a marketer. You proposed making a major change to WHMCS which might not suit the majority of users, and adds a major level of complexity to an otherwise fantastic products. Go back and search in WHMCS for SEO, and see exactly how many different contributors there have been to threads related to that topic. I proposed a workaround which would circumvent that, whilst still allowing an increase level of flexibility. If you had taken the time to investigate what i said, you would know that it is entirely possible to populate the variables (that you listed) using a variety of methods (that I listed) in a way that was outside of the header, yet acheived the effect of an individual header.tpl. Might be possible but not sure how because then your asking the header.tpl to go get the data instead of having the other templates feed the header.tpl with the data. So I'll just follow your logic of your response. You want to populate <head> with variables but not until after the the header has close and the relevant tpl has opened Just becasue I hadn't done it doesn't it mean my workaround won't work. I am exactly that solution for a number of customisations. Had you even thought about your response? And ask yourself a question. - If you slag off one contributor, how many others will make a contribution to help your business? I'm guessing that most will do the work themselves or collaborate with a group of others that they respect and trust, to benfit their own businessness. Good luck with the the topic!! Edited February 23, 2009 by Zorro67 0 Quote Link to comment Share on other sites More sharing options...
Redsign Posted February 23, 2009 Share Posted February 23, 2009 I read it that growe was referring to themself as lacking the coding experience, and the response was their response to what you said. Ben 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 Exactly Redsign. I was referring to myself. 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 You might want to be careful about making assumptions or blatant insults before posting your answers Again, I was referring to myself. I was unsure as to whether or not what I was saying made any sense or not. So I'll just follow your logic of your response. You want to populate <head> with variables but not until after the the header has close and the relevant tpl has opened No - That is not what I am saying. Since my proposal is to have the template call the header, the template would in fact be loaded first. Since that is the case, it can feed the header the necessary info. With my proposal the template would be loaded first but obviously the data is displayed after the data of the header. I am still unsure how you proposal would work. I understand that the header.tpl could call the seo.php file but not sure what the code in the seo.php file would look like. I guess if someone codes that method and posts it here, I can have a look. Maybe then my little mind will clue in. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted February 23, 2009 Share Posted February 23, 2009 Note to new members - Most come in half cocked and think they know it all. Do you really think that other members are going to attempt to help or answer your question or request if you start flaming existing members. Remember that existing long term members most likely have the knowledge that you lack because they have learnt from long time use of WHMCS. Remember to think about what your going to say in your post, be clear and give as much info as possible but most of all search the forums first before you post, most times your answer has already been answered. Now my input First off the general idea about better seo is good. Zorro67's (and Shaun) suggestion would work better as only 1 file needs to be included into the existing header.tpl The way you want to do it having a blank header.tpl and creating a new custom tpl then in every other tpl would have to have an include inserted into them. What happens when we have to do an upgrade, go through and change every tpl file. Lets be realistic, by creating 1 file (eg.. seo.tpl) and include it once in the main header.tpl will save hours of wasted time changing every tpl file when upgrade time comes along. 0 Quote Link to comment Share on other sites More sharing options...
Redsign Posted February 23, 2009 Share Posted February 23, 2009 Note to new members - Most come in half cocked and think they know it all. Do you really think that other members are going to attempt to help or answer your question or request if you start flaming existing members. Remember that existing long term members most likely have the knowledge that you lack because they have learnt from long time use of WHMCS. Sparky, if you read above you'll see Zorro misunderstood a comment growe said earlier. This thread is throwing up some interesting ideas, so let's get this misunderstanding out of the way, welcome new members and get back on topic! Ben 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 Note to new members - Most come in half cocked and think they know it all. Do you really think that other members are going to attempt to help or answer your question or request if you start flaming existing members. Remember that existing long term members most likely have the knowledge that you lack because they have learnt from long time use of WHMCS. Remember to think about what your going to say in your post, be clear and give as much info as possible but most of all search the forums first before you post, most times your answer has already been answered. Wow, let's back up the train here. I seriously was talking about myself. I told Zorro67 that I wasn't going to make it public but here is part of a PM I sent to Zorro67: .. . I'm sending this via PM because there is no need to make it public. Listen "Mr 11 Posts". Hmmm - As far as I know the number of posts shown relates to the number of times a person has posted a message on this particular site and does NOT relate to the persons coding knowledge. In this case both my number of posts and coding knowledge are low. I just wondered how you made the relation between the number of posts and my coding knowledge. Was it an assumption? You might want to be careful about making assumptions or blatant insults before posting your answers I didn't make any assumptions... I was talking about myself. I will on the other hand not hold it against you that you did by leaving that message. If you had taken the time to investigate what i said, you would know that it is entirely possible to populate the variables (that you listed) using a variety of methods (that I listed) in a way that was outside of the header, yet acheived the effect of an individual header.tpl. You are possibly correct; hence, the reason why I said that someone with more coding knowledge may be able to leave a more intelligent comment than I. Personally I don't understand how it will work that way but that might just be due to my lack of coding knowledge. And ask yourself a question. - If you slag off one contributor, how many others will make a contribution to help your business? I'm guessing that most will do the work themselves or collaborate with a group of others that they respect and trust, to benfit their own businessness. Again, I won't hold it against you for "slagging" me. I have been the victim of assuming things and making an ass of myself before. It would not be fair to hold it against others. Here's a dumb joke... Do you know what you do when you assume? You make an ass out of u and me... ass-u-me. Ok ok so it is a dumb joke. Please don't hold that against me. Now my inputFirst off the general idea about better seo is good. Zorro67's (and Shaun) suggestion would work better as only 1 file needs to be included into the existing header.tpl The way you want to do it having a blank header.tpl and creating a new custom tpl then in every other tpl would have to have an include inserted into them. What happens when we have to do an upgrade, go through and change every tpl file. Lets be realistic, by creating 1 file (eg.. seo.tpl) and include it once in the main header.tpl will save hours of wasted time changing every tpl file when upgrade time comes along. You are probably right but as I told Zorro 67 in the PM... my little brain can't understand what the code would look like. I look forward to seeing the code once someone posts it. The only way to learn is from those that know more. 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 This thread is throwing up some interesting ideas, so let's get this misunderstanding out of the way and get back on topic! Agreed. I guess it would be prudent for me to make an apology though. Zorro67, I am sorry for being unclear with my words and insulting you. I didn't mean to but I understand that you took it that way. I am sorry. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 23, 2009 Share Posted February 23, 2009 OK, then lets put it down to a mis-communication. You could do the custom header scenario, but the PHP files are encrypted, which is not likely to change anytime soon, (unless of course some-one is 'cheap' and dishonest enough to use a cracked copy - in which case I'm not intersted in helping). So lets work first in the environment we currently work in. There are about 11 or 12 php files that are called to access various functions (excluding custom pages) Some of these are irrelevant to SEO, as they are restricted to clients only Some of these php files (such cart.php) access multiple templates, depending on what step of the process these are on. Each of the relevant php files (even though encrypted) set some initial variables, relevant to those groups of templates. Its on the basis that that a given variable exists (ie it has been called) that you can use that as a flag to set some of your variables. So correct me if I am wrong but the process is- PHP file called -> sets variables -> calls header tpl file -> calls body tpl file -> calls footer tpl file ->runs server-side scripting -> present html to browser. 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 I understand a bit about what you are saying but I am obviously a little slow here. Let's assume I either create a custom template or heavily modify an existing one. After making the new template file, I want to somehow tell the header.tpl what META info to use. For example, let's use the "keywords" meta tag? Are you suggesting that I would then have to modify the seo.php somehow to include the keywords for the template I just created? if so, that is where I am confused.... due to my lack of coding knowledge, I am unsure what that code would look like. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 23, 2009 Share Posted February 23, 2009 i went your original train of though on this 6 months ago, and was politely but directly pointed to Sparky's conclusion - because - your upgrades will KILL you. After doing two ugrades the hard way, I wised up. So I now put as many of my customisations in include filename.inc.tpl or .inc.php, so as to make the file comparison/upgrade process as painless as possible. Back to Part 2 of last post (he says moving on to a constructive train of thought). So if we a limited number of alternative variable being called, why not use that as a flag for running the code that sets the variable for seo. The challenge is that you need to present the variables in the head section, which I (poorly) described previously, as being flagged in the header file. Once you get to the body.tpl (whichever one that is) its too late to set the seo variables that you listed. Whther the variables are populated from a) a known ranges of phrases in an array, b) from a db call in a custom table, c) extrapolated from existing variables, page names titles etc, d) or a combination of all 3 (which is my preferred option) is really down to personal choice and coding ability and input from others. Check the SEO Thread in the wiki (above), have a look at this thread, http://forum.whmcs.com/showthread.php?t=5427 (special mention to the poster of post #17) And see if you can add to the mix. Cheers 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 23, 2009 Share Posted February 23, 2009 there is scope for some-one to come up with a hack that allows you to tag meta words and descriptions by article, but thats neither currently available, nor talked about in the forum. I understand a bit about what you are saying but I am obviously a little slow here. Let's assume I either create a custom template or heavily modify an existing one. After making the new template file, I want to somehow tell the header.tpl what META info to use. For example, let's use the "keywords" meta tag? Are you suggesting that I would then have to modify the seo.php somehow to include the keywords for the template I just created? if so, that is where I am confused.... due to my lack of coding knowledge, I am unsure what that code would look like. Sorta, but not. My last post (cossed in the ether) described the how If I'm in the DL section, I should think that my meta words are likely to include things like the name of the category (and any subcategories), page title, and perhaps some generic words where-as my meta description would be the first say 50 wards of the article text. however, if I'm in the KB section i might want meta words to include some extra info that is contained in some of the variables set with the KB. there are little scripts available that could also strip generic words out of the text of the article, thereby giving you a raft of (probably) relevant keywords. However, the biggest impact that you can have on SEO is getting your TPLs right for thing like h1/h2 tags, title tags for links, alt7 title tags for images, and removing basic formatting errors in the tpls. Hope that's clearer 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 Ok - I'm starting to see where you are going here. No matter how you cut it, there is a painful task at hand. The question is: how many times do you want to do the task? Method 1 - Have a blank header.tpl and a new custom_header.tpl Pros: 1) Very easy to set variables to exactly what you want. 2) Anything can be passed to the header even if the data is nowhere else... ie Robots META tag. If you want to set a particular page to "noindex,follow" it is very easily done. Cons: 1) A new line will have to be added to the top of each template 2) The line will have to be readded after each upgrade. Method 2 - have the header.tpl call another file Pros: Cons: Since you fully understand it, I'll let you complete the Pros/Cons 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 Hope that's clearer Ya it is a bit clearer; however, the seo.php will need to be quite indepth. Beyond my skill level. I tried using some of the $variables like you suggested; however, I ran into a problem with it pulled code that was in the text and put it in my meta tags. They will need to be parsed out first. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted February 23, 2009 Share Posted February 23, 2009 Ok - I'm starting to see where you are going here. No matter how you cut it, there is a painful task at hand. The question is: how many times do you want to do the task? Yes, as this doesn't yet exist (at least in the communal space) this sort of development is often first done by the community, and then later intergrated in to the main product (which often solves the upgrade issue) Method 1 - Have a blank header.tpl and a new custom_header.tplPros: 1) Very easy to set variables to exactly what you want. 2) Anything can be passed to the header even if the data is nowhere else... ie Robots META tag. If you want to set a particular page to "noindex,follow" it is very easily done. Cons: 1) A new line will have to be added to the top of each template 2) The line will have to be readded after each upgrade. By using the header method mentioned earlier, its just one line added to your header.tpl - don't forget your custom pages still call the header.tpl (unless you tell it not to for thing like invoices) Also your custom pages remain unchanged in an upgrade. Method 2 - have the header.tpl call another filePros: Cons: Since you fully understand it, I'll let you complete the Pros/Cons Pro's: -the code can be added to as each additional functionality is added. - one file is called no matter what tpl file is called. Cons - can't see any, but happy to be stood corrected. 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 So are you relying on the code to figure out how to populate each variable based on some rule set? Ouch, don't like the sounds of that. I would prefer to define things like the description and keywords by hand. The first sentence of an article may or may not be relevant. Having the script figure out keywords would be even more difficult. There's one con. How would you handle info such as the ROBOTS meta tag on a per template basis? How is the rule set in seo.php supposed to know whether or not you want a site indexed or followed? 0 Quote Link to comment Share on other sites More sharing options...
growe Posted February 23, 2009 Author Share Posted February 23, 2009 Method 1 - Have a blank header.tpl and a new custom_header.tplCons: 1) A new line will have to be added to the top of each template 2) The line will have to be readded after each upgrade. Hmmm - Maybe I need to rethink this. I am new to WHMCS so I still only have an out of the box install but am I correct in saying that if a site is heavily modified then the templates wouldn't be automatically replaced by default on an upgrade. Any custom templates wouldn't change at all. A manual change would need to be made to the one or two templates that changed as part of the upgrade. Since only a specific part of the template is being modified, the call to the custom_header.tpl wouldn't even need to be touched. Again, I have yet to modify my install or do an upgrade so I may be talking out of my arse but I don't think an upgrade would affect anyone except those still using out of the box templates. Am I correct? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.