But, no more!

Using HESK (and Mods For Hesk), we have a WONDERFUL way to now keep the docs UP TO DATE on all the changes made - and the 'Admin' folks can make changes that won't burn up your time!
Dynamic Knowledgebase
Following are the SIMPLE instructions to make your knowledgebase articles DYNAMIC! (the code is kept simple-for-anyone to implement and follow along, though could be trimmed by more advanced programmers)
- add a file (let's call it 'dynamic_knowledgebase.php') to the /inc directory (you can name/put it anywhere, as long as you know how to point to it below)
- add the following array to the file
(this is the file where you will store all your 'dynamic' bits of data PRO POINT: make references back to your main config file and/or database to make sure there is ONE location for this data being stored!)
Code: Select all
$knowledgebase[dynamic'] = array( "%%FIRSTITEM%%" => "Dynamic data for Item #1", // just an example, you can use ANY sort of variable you like! "%%SECONDITEM%%" => "Dynamic data for Item #2" );
- add the following array to the file
- open /inc/common.inc.php in your code editor
- add this function to the BOTTOM of the page (makes it simple to find)
Code: Select all
function dynamic_knowledgebase($content) { include_once HESK_PATH . "inc/dynamic_knowledgebase.php"; // Note that this IS correct! foreach($knowledgebase['dynamic'] as $key => $value){ $content = str_replace($key,$value,$content); } return $content; }
- add this function to the BOTTOM of the page (makes it simple to find)
- in the ROOT of your HESK installation, look for the file "knowledgebase.php" and open it in your code editor.
- search for "$article =" (you should find 3 instances - note that not all 3 are the same - but that is OK!)
- BELOW THE LINE with '$article =' in it (i.e., you are inserting NEW code AFTER that line, not modifying anything already there), add the following code
(remember to do this for all 3 locations in this file)Code: Select all
if (!empty($article['content'])) { $article['content'] = dynamic_knowledgebase($article['content']); }
- search for "$article =" (you should find 3 instances - note that not all 3 are the same - but that is OK!)
- in the /admin folder of your HESK installation, look for the file "knowledgebase_private.php" and do the SAME as above (again, 3 places).
Now, go create a new KB article with the following text:
Save the article and go take a look at it!Isn't it FANTASTIC how we can now, using a SIMPLE mod, have %%FIRSTITEM%%, %%SECONDITEM%% and MORE - in fact, as many DYNAMIC items as you could ever want!
ENJOY!Isn't it FANTASTIC how we can now, using a SIMPLE mod, have Dynamic data for Item #1, Dynamic data for Item #2 and MORE - in fact, as many DYNAMIC items as you could ever want!