Smarty.class.php error - php

I'm setting up the smarty, and it seems to work fine, new html was generated properly but there is one error message as follows:
"Notice: Undefined property: Smarty::$complie_dir in
/Applications/XAMPP/xamppfiles/Smarty-3.1.18/libs/Smarty.class.php on line 705".
It seems like there is some problem in Smarty.class.php contents.
Any ideas, please.

You want to access Smarty::$complie_dir but it property is named compile_dir not complie_dir.
However it seems it won't work anyway because you use Smarty 3.1.18 and:
As of Smarty 3.1 the attribute $compile_dir is no longer accessible directly. Use getCompileDir() and setCompileDir() instead.
So you should use those 2 methods to get or change compile directory

Related

What is the correct way to include PHP functions in Joomla for use in articles?

I am using Joomla 2.5 and DirectPHP. I can run PHP code in an article just fine. I would like to include a library of PHP functions to be available for use in all articles. What is the best way to include the function library?
I tried including (with require) from the template's index.php and even putting the functions directly in index.php, as suggested here. None of the functions are defined in the article. A test with variables and global variables also finds them undefined in the article.
I then created a custom HTML module with the PHP functions that I then used in my template, but they are still undefined in the article. Oddly enough, if I try and declare the function again in the article I get "Cannot redeclare...". How can the function be both undefined, not re-defineable?
I also tried using a namespace to define and use my functions. Same result.
Code in my custom html module:
<?php
namespace c6;
function testit5()
{
echo "hello world 5";
}
?>
Code in my article:
<?php
namespace c6;
testit5();
?>
Result:
Fatal error: Call to undefined function c6\testit5() in /home/testsite/www/www/c6test/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 5
go to,
Login to admin -> Extensions Menu -> Module Manager -> Create New Module -> Choose Custom HTML
and create you own module and add php functions.
I figured it out! My problem was the order Joomla processes things. Apparently the article is processed first, then the template. So my code using the function executed before the module that defined the function was executed. (When I got the "cannot redeclare" error, it was coming from the template, not the article.) I moved my loadposition from the template to the article and it works.

phpstorm accept undefined variables

I'm trying to understand unexpected behavior by PHPstorm. I've two files without any include or required definitions.
// file1.php
<?php
$var = new class1();
// file2.php
<?php
class class1 { }
I would expect that class1 is undefined in file1, because file2 is not included. But phpstorm shows no warning. CTRL-B jumps to the declaration in file2. The option "Ignore include and require statements" is unchecked. Could someone explain this to me?
phpstorm doesn't know everything about your context. it is possible that the files are required by some other file one after another so everything will just work. Also there is a good chance, that you are using autoloader/composer (who doesn't?) which will take care of the issue.
So, I think they wouldn't consider this an error, as they wouldn't be able to properly filter false-positives if they enabled such warning
This is most likely a bug in PHPStorm itself, since PHP throws an exception.
Fatal error: Class 'class1' not found in /srv/www/htdocs/swaggityswoogityswoo/f1.php on line 5 Call Stack: 0.0003 629360 1. {main}() /srv/www/htdocs/swaggityswoogityswoo/f1.php:0
Since I upgraded to the latest versions, it seems to behave strange. For example, when i try to merge a file where the deployed adn the local file both contain contain 'text-align: left', he wants to merge it into 'text-align: center'.
Just wait until they release another version, maybe they'll be able to fix this bug.

ModX Evo: PHP error in document.parser.class.inc.php

So my Evo site stopped working the other day - just got a 500 error. I got my host to check the logs and found this:
[error] PHP Fatal error: Cannot redeclare insert_metka() (previously declared in
/home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code:2)
in /home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code on line 12
I have tired commenting out the offending line and removing the entire file to no avail. Does anyone know what this means and how to fix it?
EDIT: the code at line 790:
eval ($pluginCode);
Looks like a bad plugin has broken your site. Disable all your plugins and reinstate them one at a time until it breaks again, then you know which one is the culprit.
Once you've done that, post the plugin code here and we can help you debug it further. You shouldn't ever need to modify the MODX source code.
The problem is likely to be solved by wrapping the insert_metka() declaration like this:
if(!function_exists('insert_metka')) {
function insert_metka() {
// function code
}
}
http://wiki.modxcms.com/index.php/Creating_Snippets#Wrap_functions_inside_.21function_exists_conditional_if_the_resource_is_needed_to_run_more_than_once_on_a_page
That appears like a very simple problem. You are declaring insert_metka() two times. Remove it from one of the mentioned files. Once it is declared in saved file and apparently second time you are trying to declare it with the help of eval()
Cannot redeclare insert_metka() says that you are declaring a function twice (may be with your evals).
You should check on your included files.
To be sure to not include more than one time, you can use include_once or requiere_once instead of include and requiere
Accoring to document.parser.class.inc.php this line i guess you are using OOP.
So what you can do is create instantiation class for above class and then overwrite it.
There are other things too. you might declaring same function inside of same class.

Third-party library not loading in Expression Engine 2.0

I'm developing a properties module for Expression Engine that's to take properties from Rightmove's BLM format and populate a database, and then those properties be searchable from the front-end.
I've found a CodeIgniter library (http://biostall.com/codeigniter-rightmove-blm-parser-library) that does the heavy lifting of the BLM files. However, I can't seem to load it.
My code in mcp.properties.php looks like this:
$config = array();
$this->EE->load->library('rightmove_v3_parser');
$this->rightmove_v3_parser->initialize($config);
$data['properties'] = $this->rightmove_v3_parser->process();
print '<pre>'; print_r($data['properties']); print '</pre>';
exit;
The library files are in a libraries sub-folder in my properties add-on folder under /system/expressionengine/third_party/.
However, when using the above code, I get the following error in Expression Engine:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Properties_mcp::$Rightmove_v3_parser
Filename: properties/mcp.properties.php
Line Number: 44
Fatal error: Call to a member function initialize() on a non-object in /Users/Martin/Sites/expressionengine/system/expressionengine/third_party/properties/mcp.properties.php on line 4
Where am I going wrong? Why can't I bundle this library with my add-on and call it within my add-on?
You've missed the EE object when referencing the library. So after loading the library you should use
$this->EE->rightmove_v3_parser
to access it, rather than
$this->rightmove_v3_parser
Have you included the library at the top of your plugin, i could be wrong but I don't think loading a library like that will work from a library subdir in your third_party plugin folder. Try including the library at the top of your plugin.

getting notice in php file while executing

what is the meaning of undefined property DOMElement::$node Vaoue
I searched in google I didn't get any annswer for this.
what is the meaning of undefined property DOMElement::$node Vaoue
It simple means that you have a undefined property DOMElement in your code.
To Help you in details we realy like to se more from the code which causes the error
Well, a good start would be to post the code you're trying to execute. Anyways most likely, a property you're trying to access is undefined.

Categories