Frequently Asked Questions | Nov 5, 2024 - 10:33am |
|
|
Frequently Asked Questions Operational Questions Macros and Templates WCJS (Server Side JavaScript)
My macro isn't working. Web Crossing must be broken.
Question |
|
|
I created a new macro and put it in webx.tpl
Web Crossing isn't executing the macro, or suddenly I'm seeing strange, apparently unrelated effects in other areas. It must be a Web Crossing bug. |
Answer |
- Did you "Reset file cache for HTML files and webx.tpl templates." after saving your changes?
- DO NOT copy the entire STANDARD.TPL (or equivalent) into webx.tpl...only copy those macro(s) you intend to modify. Likewise DO NOT modify standard.tpl or webxStd-local.tpl. **Web Crossing does not use standard.tpl in any way. webxStd-local.tpl is used in some localized situations, but nevertheless always place modified macros in their own file.**.
- Where possible, always test new macros by themselves, with no other macros in webx.tpl.
If that isn't possible, and the macro isn't executing, then put the new macro at the TOP of the webx.tpl file. If the macro now works then the problem is in another one of your other macros and is preventing WebX from reading your new one.
Try calling the macro directly in your browser: http://yoursite/webx?MacroName@@
If there is any response other than "Missing Template" then the problem is in your macro.
If "Missing Template", try #3 or #4 above, then back to #5. If still "Missing Template" see below.
- Are templates turned on? See your sysop control panel.
- Make sure to save webx.tpl as a plain text file only...not RTF or DOC etc. Web Crossing can only parse plain text.
- Can Web Crossing read or find webx.tpl? Look in the control panel. If templates are On it should say "webx.tpl templates are currently: on" If it says "webx.tpl templates are currently: not found" then make sure:
- the file actually exists in the root webx directory (versions up to 4.1) or in webxTemplates (v5.0+) and is not a symbolic link/shortcut.
- your text editor does not have a file lock on webx.tpl. Check this by closing the text editor then resetting the cache. This is common in windows with MS-Word.
- If working on a windows platform, make sure you turn off the folder option to hide extensions. Chances are you are saving your template file with a .TXT or .DOC extension! IOW, rather than webx.tpl it is webx.tpl.txt
- permissions on the file and/or webx haven't accidently been changed.
- Variables (in JavaScript) and directives are case sensitive: myName is not the same as MyName, setPath is OK, setpath is not.
- Look for common syntax errors:
- Not closing off a directive with "%%", but rather "%" or "&&"
- Missing %% endif %% or %% endwhile %% statements.
- Improper use of operators: %% if A == 1%% not %% if A = 1%%. Same goes for & vs &&
- "Not equals" is "!=", and not "<>".
- Improper matching of closing ")"
- Broken HTML syntax. Particularly with TABLEs, missing closing tags, etc
- Missing %% certificate %%
|
|
|
|
|