Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
php inside javascript file
How do i include php inside javascript file
I have a file called Vcal.js.php which looks like this
the php code
I have a file called Vcal.js.php which looks like this
<?php
header("Content-Type: text/javascript");
include("../../../appg/settings.php");
include("../../../appg/init_vanilla.php");
global $Context;
?>
$(document).ready(function() {
$("form#frmPostDiscussion").before('<div class="ErrorContainer"><div class="ErrorTitle"><?php $Context->GetDefinition('VcalErrorTitle') ?></div><div class="Error"><?php $Context->GetDefinition('VcalError') ?></div></div>');
});
the php code
<?php $Context->GetDefinition('VcalErrorTitle') ?>
result in nothing. It cannot find the definition 0
This discussion has been closed.
Comments
<?php echo $Context->GetDefinition('VcalErrorTitle'); ?>
or
<?=$Context->GetDefinition('VcalErrorTitle')?>
.<?php $Context->GetDefinition('VcalErrorTitle') ?>
is nothing. :Pyou can add php in css file as well just like above and have css values be generated by php
header('Expires: '. gmdate( 'D, d M Y H:i:s', time() + 3600) . ' GMT'); header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $LastModification) . ' GMT'); header('ETag: ' . $LastModification); header('Content-Type: text/javascript'); header('Pragma: '); //overwrite the one set in appg/header.php
$LastModification should the last modification time of the php file or one of the file that set the variable that it uses.
can you explain $LastModification one more time
if example.js.php use a variable set into settings.php its the last modification time will its own modification time or the one of settings.php.
You script before sending the data to the browse should check has a up to date version of the document (check $_SERVER['HTTP_IF_MODIFIED_SINCE']) and send
header($_SERVER['SERVER_PROTOCOL'] .' 304 Not Modified'); exit();
if it is up to date.