How to correctly install .js script in my phpWCMS

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
User avatar
Chaffinch<
Posts: 52
Joined: Mon 30. Mar 2009, 18:36
Contact:

How to correctly install .js script in my phpWCMS

Post by Chaffinch< »

Gentlemen, I have a request for help.
European Commission Cookies Directive
How to customize the script,to the requirements: European Commission Cookies Directive
The script can be found at:
.............
I need to adopt it in my WEBSITE
So please to explain how to do it in my phpwcms.To my site meet the legal requirements.
How to correctly install .js script in my phpWCMS

Please help in this regard
Regards
Bogdan
Last edited by Chaffinch< on Fri 5. Apr 2013, 18:17, edited 1 time in total.
Best Regards,
P.S. Sorry for my English or Deutsch.
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: How to correctly install .js script in my phpWCMS

Post by Oliver Georgi »

Hi Bogdan,

all you have to do is to add the related JavaScript to your template. Best would be to use the replacer, maybe you have placed the "1.5.js" here

Code: Select all

template/lib/cookieDirective/1.5.js
then it should work like this…

If you have JS script should be loaded by that directive you will need an additional JS function which is called by the cookieDirective script. Do NOT use if nothing to do here or place a ; inside there too!!!

Code: Select all

<!-- JS: 
function cookiesDirectiveScriptWrapper(){
    // Cookie creating scripts etc here....
}
-->
Then this, which will load the cookieDirective script:

Code: Select all

<!-- JS: {TEMPLATE}lib/cookieDirective/1.5.js -->
And after that the code needed to let the cookieDirective do what it should do (follow the documentation)

Code: Select all

<!-- JS: cookiesDirective('top',5,'privacy.html'); -->
And if there is something you want to do/show when the cookie is active/found use a frontend render script, maybe cookieDirective.php. Maybe use a replace for any information about the cookie seting:

Code: Select all

<?php
// we need a qualified check — see the empty()
if(!empty($_COOKIE['cookiesDirective'])) {
    $content['all'] = str_replace('<!-- cookieDirective -->', '<p>Cookie Directive is active, whatever…</p>', $content['all']);
}
?>
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
Chaffinch<
Posts: 52
Joined: Mon 30. Mar 2009, 18:36
Contact:

Re: How to correctly install .js script in my phpWCMS

Post by Chaffinch< »

Thanks very much for Yours SUPPORT
It works fantastically, example: :lol: :D :wink:
http://www.arsvetkrynica.pl

Regards
Bogdan
Best Regards,
P.S. Sorry for my English or Deutsch.
Post Reply