I'm attempting to install CKeditor on Kohana 2. I've dropped the ckeditor folder into libraries/ and put ckeditor.php alongside the ckeditor folder in libraries/. I'm trying to call ckeditor in my controller with the following:
$this->ckeditor = new Ckeditor('FCKEDITOR1');
$this->ckeditor->BasePath = 'application/libraries/ckeditor/';
$this->ckeditor->value = 'This is some <strong>sample text</strong>.' ;
$this->ckeditor->create();
I'm getting the following error and having a hard time solving it:
Fatal error: Call to undefined method
CKEditor::create() in
[path redacted]/app-admin/controllers/blog.php
on line 18
well its simple: there is no such function in the CKEditor class.
also found this in comments:
* Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
* $CKEditor = new CKEditor();
* $CKEditor->returnOutput = true;
* $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
* echo "<p>Editor 1:</p>";
* echo $code;
Related
Been pulling my hair for 2 hours on this Smarty 2.6 to Smarty 3.1 upgrade task for that old website. The reason is that the host is now PHP 7 only. No more PHP 5. I thought it would be a 1 hour deal, but it's quickly turning into a nightmare. I remember using Smarty back in 2005 and I've never used it ever again, but today, nearly 15 years later, this monstrosity of a template engine is haunting me back!
Here's the init PHP file's contents:
<?php
#Load Smarty library
#require_once("php/Smarty-2.6.26/libs/Smarty.class.php");
#require_once("php/smarty-3.1.34/libs/Smarty.class.php");
require_once("php/smarty-3.1.34/libs/SmartyBC.class.php");
require_once("php/smarty-3.1.34/libs/sysplugins/smarty_security.php");
class class_init extends SmartyBC {
function __construct(){
#Init
parent::__construct();
#Directories
$this->template_dir = "skin/".SKIN."/public/";
$this->compile_dir = "skin/".SKIN."/compile/";
$this->config_dir = "skin/".SKIN."/config/";
$this->cache_dir = "skin/".SKIN."/cache/";
#Caching
$this->caching = (boolean)SMARTY_CACHING;
$this->cache_lifetime = (int)SMARTY_CACHE_LIFETIME;
$this->debugging = true;
}
function is_cached($str_tpl, $cache_id = NULL, $compile_id = NULL){
return $this->isCached($str_tpl, $cache_id, $compile_id);
}
}
class MySecurity extends SmartySecurity {
public $secure_dir = array('/home/lesclownsducarro/public_html/');
public function __construct(Smarty $smarty){
parent::__construct($smarty);
}
}
?>
Here's the controller file's contents:
require_once("./php/class/init.php");
$_ENV['class_init'] = new class_init();
$securityPolicy = new Smarty_Security($_ENV['class_init']);
$securityPolicy->php_handling = \Smarty::PHP_ALLOW;
$_ENV['class_init']->enableSecurity($securityPolicy);
Getting a completely blank page and the error_log simply states:
[30-Dec-2019 22:22:40 UTC] PHP Fatal error: Class 'SmartySecurity' not found in /home/xxxxx/public_html/php/class/init.php on line 32
FOR BACKWARDS COMPATIBILITY, I need to use SmartyBC because the template is including PHP files all over the place. inb4 yes I know, and this is not my website.
Any ideas ?
DOH. Welp, I'm just too tired, it seems.
It should obviously be: $securityPolicy = new Smarty_Security($_ENV['class_init']);
...with the underscore. I don't know, I copy/pasted the example from smarty.net without paying any attention at all. "new SmartySecurity" as seen here: https://www.smarty.net/forums/viewtopic.php?p=72741
JFC.
I am trying to use the output from a php file in a TemplaVoila FCE.
According to the articles, etc, I have found on the subject, I seem to be doing it right. But it does not work.
I have reduced my implementation to a very simple test, and I hope that someone here can tell me what I am doing wrong.
The php code is in fileadmin/php/test.php
The file contains this code:
<?php
function getBeechgroveTest($content, $conf)
{
return 'B';
}
//echo getBeechgroveTest(0,0);
?>
In the main template (template module - not TemplaVoila) I have added this line:
includeLibs.beechgroveTest = fileadmin/php/test.php
I have tried to put it at the root level and inside a PAGE object. Both gave the same result.
If I uncomment the 'echo' line I get a 'B' at the top of my HTML page, so the php must be read at some point.
My FCE has one field of type 'None (TypoScript only)' and contains this code:
10 = TEXT
10 {
value = A
}
20 = USER
20 {
userFunc = getBeechgroveTest
}
30 = TEXT
30 {
value = C
}
I was expecting the FCE to output 'ABC', but I only get 'AC'.
What am I doing wrong?
I use TYPO3 version 4.5.30 and TemplVoila 1.8.0
It must by problem in cache, try use USER_INT instead USER. If you create this object as USER_INT, it will be rendered non-cached, outside the main page-rendering.
20 = USER_INT
20 {
userFunc = getBeechgroveTest
}
In my config.ini file given
customer.login.test = "test case"
customer.login.support[] = "abel"
customer.login.support[] = "justin"
customer.login.support[] = "leon"
I tried to access it in zend action helper function as
$config = \Zend_Registry::get("config");
echo $config->customer->login->test; // Outputs as "test case"
print_r($config->customer->login->support); // No Result
print_r($config->customer->login->support->toArray()); // Gives Error
ERROR: Call to a member function toArray() on a non-object
How to correct this problem?
EDIT:
support[] = "abel"
support[] = "justin"
support[] = "leon"
In zend action helper function
print_r($config->support->toArray());
Above print_r statement gives me a correct array. How this happens?
I've just tried your code. It works fine.
It looks like you don't set customer.login.support[].
This can happen if you load another section of config file (e.g. testing instead of development) which also have customer.login.test but doesn't have customer.login.support[]
I use JasperServer and PHP JavaBridge to generate PDF reports via JasperServer inside PHP. I get compile error because of missing (unassigned) parameter passed to JRXML compiler
Fatal error: Uncaught [[o:Exception]:
"java.lang.Exception: Invoke failed:
[[c:JasperCompileManager]]->compileReport((o:String)[o:String]).
Cause: net.sf.jasperreports.engine.design.JRValidationException:
**Report design not valid** : 1. **Query parameter not found** : db_field_id VM:
1.6.0_18#http://java.sun.com/" at: #-12
net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:258)
I cant find a way to pass my
$params = new Java("java.util.HashMap");
foreach ($jrxml_params as $key => $jr_param) $params->put($key, $jr_param);
list of params to the compile method nor I can disable this verification by
$japser_props = new JavaClass("net.sf.jasperreports.engine.util.JRProperties");
$japser_props->COMPILER_XML_VALIDATION = false;
Here is what I use to generate PDF (works fine if JRXML file doesn't contain $P{} pamareters and halts otherwise)
$class = new JavaClass("java.lang.Class");
$class->forName("com.mysql.jdbc.Driver");
$driverManager = new JavaClass("java.sql.DriverManager");
$conn = $driverManager->getConnection("jdbc:mysql://localhost:3306/XXX?user=XXX&password=1234");
$compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
$report = $compileManager->compileReport(realpath("/www/some.jrxml"));
$params = new Java("java.util.HashMap");
foreach ($jrxml_params as $key => $jr_param) $params->put($key, $jr_param);
$jasperPrint = $fillManager->fillReport($report, $params, $conn);
$exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
$outputPath = realpath(".")."/"."output.pdf";
$exportManager->exportReportToPdfFile($jasperPrint, $outputPath);
How do I avoid this error, I know what I need to pass and I don't know a way to do it, can't I just pass params to fillManager?
$japser_props = new JavaClass("net.sf.jasperreports.engine.util.JRProperties");
$japser_props->setProperty('net.sf.jasperreports.compiler.xml.validation',true);
this is the way to set property from PHP but that's not the problem. It turns out everything was fine, I've missed parameter declaration before my MySQL query... Put
<parameter name="db_field_id" class="java.lang.Integer">
in your JRXML before you use it as $P{db_field_id} now it compliles fine and later
$jasperPrint = $fillManager->fillReport($report, $params, $conn);
parameters are assigned at fill time
I am trying to load some doctrine extensions but I get all sort of errors. So far this is what I have
In my ini:
autoloaderNamespaces[] = "DoctrineExtensions"
resources.doctrine.classLoader.loaderClass = "Doctrine\Common\ClassLoader"
resources.doctrine.classLoader.loaderFile = "Doctrine/Common/ClassLoader.php"
resources.doctrine.classLoader.loaders.DoctrineExtensions_Paginate.namespace = "DoctrineExtensions\Paginate"
resources.doctrine.classLoader.loaders.DoctrineExtensions_Paginate.includePath = APPLICATION_PATH '/../library/Doctrine/DoctrineExtensions/Paginate/'
And in one of my controllers:
$count = Paginate::getTotalQueryResults($query); // Step 1
$paginateQuery = Paginate::getPaginateQuery($query, $offset, $limitPerPage); // Step 2 and 3
$result = $paginateQuery->getResult();
And this is the error:
Warning: include_once(DoctrineExtensions/Paginate.php): failed to open stream: No such file or directory
Try something simple
//include class loader first
//make sure this is correct
$doctrine_root=APPLICATION_PATH. '/../library/Doctrine';
require_once $doctrine_root.'/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine',$doctrine_root);
$classLoader->register();
user Doctrine\DoctrineExtensions\Paginate;
Then try reset of the code
$count = Paginate::getTotalQueryResults($query); // Step 1
// Step 2 and 3
$paginateQuery = Paginate::getPaginateQuery($query, $offset, $limitPerPage);
$result = $paginateQuery->getResult();
let me know how this works
cheers :)
Note : I haven't tested this code at my end
I suggest you try this plugin: beberlei / DoctrineExtensions
And here are the details on how to integrate it into your project: README
I do not think you can do so for as the developer has built the extensions! :S
In order to use the autoload for the class Paginate, the class should have been called DoctrineExtensions_Paginate_Paginate.
Good Luck!