Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi guys,

I'm struggling with adding variables in my php and js files...
I try to implement those like i do with my normal page files but i think i'm doing something wrong.

Is it possible to explain how to prepare a php file (like a phpmailer) and a js file?
I'm managed to do this with a css file but now i'm stuck.

Thanks in advance.
Bert
More information please!
Exactly how are you trying to add the variables and what is the outcome?
Hi KK,

This is an example of what i trie to implement.

Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
    <cms:template title='Mailer' order=''>
    </cms:template>
<?php
   // Your Email
   $recipient = '<cms:get_custom_field 'form_mail' masterpage='settings.php' />';

// Rest of php
<?php COUCH::invoke(); ?>


Or with JS

Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
    <cms:template title='JS' order=''>
    </cms:template>
$( document ).ready( function(){
var text1 = '<cms:get_custom_field "var_js_text1" masterpage="settings.php" />';

// Rest of JS
<?php COUCH::invoke(); ?>
Thanks for the clarification.

1. Using Couch tags with raw PHP is a bit tricky (viewtopic.php?f=2&t=10763) so the best way would be to use <cms;php> .. </cms:php> Couch tags instead. Mostly it works just the same as raw PHP but you might have to declare some global variables (the above mentioned thread discusses this point).

2. Using Couch tags with JS is standard fare and the code you posted should work just fine. If it does not, chances are that the generated code has errors - do a view-source to examine and debug.

Hope this helps.
4 posts Page 1 of 1