I am trying to set up a cakePHP blog. Following the steps at:
http://www.marcofolio.net/webdesign/building_a_blog_with_cakephp_part_1_getting_started.html
but when I get to the stage of creating 'article.ctp' in order to view the 'Read More' part of the blog. I get the following error messages:
Notice (8): Undefined index: id = 1 [CORE/Cake/Model/Model.php, line 2519]
Notice (8): Undefined index: id = 1 [CORE/Cake/Model/Model.php, line 2495]
Notice (8): Undefined variable: articles [APP/View/Blog/article.ctp, line 1]
Sadly this is hosted on my test server locally in MAMP so I can't show you the live error I am getting. But just thought id check and see if anyone has had similar issues with this (I believe its a common beginner tutorial for learning to use cakePHP)
That's an ancient tutorial, try out the cakephp 2.x blog tutorial from the official site:
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html
And your error is quite simple, the variable $articles does not exist in your view, so you haven't set the variable in your controller with $this->set('articles', 'value');
Related
I am working on a site that suddenly has these error messages:
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined variable: post in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined property: Elementor\Core\Kits\Documents\Kit::$ in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Trying to access array offset on value of type null in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:50 UTC] PHP Notice: Trying to get property 'ID' of non-object in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
The errors showed up whenever a customer tried to put a variable product into the shopping cart. On the front end it says:
This doesn't happen if the customer adds a non-variable product to the cart, so I am not sure what is happening or how to repair this. I have reached out to elementor with no response at this point after 24 hours.
The code referenced in the error log is:
public function get_main_id() {
if ( ! $this->main_id ) {
$post_id = $this->post->ID;
$parent_post_id = wp_is_post_revision( $post_id );
if ( $parent_post_id ) {
$post_id = $parent_post_id;
}
$this->main_id = $post_id;
}
return $this->main_id;
}
This occurred after the site was moved to a new hosting company, however, the site was working fine for the past three weeks, and the issue wasn't present.
I was able to figure out (With the help of Elementor Tier 2 support) that the hosting provider (Site Grounds) installs a plugin called "SiteGround Optimizer" that was causing this issue. There is a conflict between this plugin and Elementor in case anyone is having this issue.
EDITED: SiteGround was able to turn off the "Defer Render-blocking JavaScript" feature and the plugin worked with the rest of the site. If you are having a strange issue and you are on SiteGround, I highly recommend you turn this feature off to troubleshoot the issue better.
This is occurring on Kinsta too - so it's not just the SG plugin. It could still be optimization related - but I can't seem to find a resolution yet (even rolling back versions isn't helping me).
that issue comes in new version of elementor, just rollback it previous version following this video https://youtu.be/3uwCRcQvIFw
Please help me: I get an error when I pass data to a view. I think it's the correct procedure but i get error..
Controller:
$data['success']='1';
$this->load->view('user_control/register', $data);
View:
echo $success;
Got Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: success
Filename: views/register.php
Line Number: 79
Ok, it is working perfectly. Take a look at my screen shots and try emulate.
My Controller
My View (Code)
And finally the result on the screen.
If it is still not working, make sure you have you are running Codeigniter in htdocs on a Lampp or Xampp stack.
Not a codeigniter programmer but you should check your view Filename from your controller you have passed $this->load->view('user_control/register', $data); i guess filename should be in
views/user_control/register.php
Newbie here to OpenCart extension development. I am currently developing a 99Bill (Chinese payment method) payment extension.
Currently, I've added new files to the MVC directories (so, I added files under admin, catalog, etc, where I named my extension bill99, since PHP doesn't allow names that start with numbers).
I was trying to test my extension, but on my OpenCart home page, I get the following error:
Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20Notice: Undefined index: mobile_description in /vagrant/opencart/upload/catalog/model/catalog/product.php on line 20
I am not quite sure how I triggered it, since I never edited or touched the product.php file before. The error appears even if I disable/uninstall my 99Bill extension.
When I navigate to product.php, line 20 simply says:
'description' => $query->row['mobile_description']
I have a feeling my error has nothing to do with the product.php file, since I never touched it before, and likely relates to my 99Bill extension. I may have not initialized a class somewhere.
For someone that's had this error before, could you help me understand this?
Well: line 20 accesses an array index, doesn't it? Suppose the index doesn't exist, wouldn't the error message you get make sense then? try dumping the contents of $query->row or replace what you have now with:
'description' => isset($query->row['mobile_description']) ? $query->row['mobile_description'] : null,
As far as why you get this notice: This answer explains that, and contains some snippets that could help you refactoring your code
hoping somebody can help,
having an issue with a news posting section on a Joomla site: http://buffalowingsandrings.com/#/in-the-news - You'll see if you scroll down, that there are lots of empty fields. We only want to display 10 news stories and we are unsure why these blank ones are appearing.
I didn't build the site, I just have access and have to fix for a client.
After turning on the error reporting we see the following errors:
Notice: Undefined property: stdClass::$created in
/home/content/16/11371716/html/templates/bwr_pages/html/com_content/category/blog_item.php
on line 3 11 September 2014
Notice: Undefined property: stdClass::$readmore_link in
/home/content/16/11371716/html/templates/bwr_pages/html/com_content/category/blog_item.php
on line 6
Notice: Undefined property: stdClass::$title in
/home/content/16/11371716/html/templates/bwr_pages/html/com_content/category/blog_item.php
on line 9
Notice: Trying to get property of non-object in
/home/content/16/11371716/html/components/com_content/views/category/view.html.php
on line 217
Notice: Undefined property: stdClass::$attribs in
/home/content/16/11371716/html/components/com_content/views/category/view.html.php
on line 225
Notice: Undefined property: stdClass::$id in
/home/content/16/11371716/html/plugins/content/vote.php on line 23
Any help would be greatly appreciated!
I may guess that those empty block's might come from inefficient code for the view of this menu item for the extra content settings like intro items or link items.
You can try this:
Go in the menu manager, locate the menu item for this blog page ( in-the-news ) and check its parameters basic section (on the right) for how many articles are set to be displayed.
How many leading and intro articles, how many links...
Maybe you would like to set links to 0 and also experiment with the leading / intro articles count number and see how this affecting the front-end.
Please note also that changes may not appear right after your changes, so clear joomla's and browser cache when checking in the front-end.
Using adLDAP.php class
receiving following error: Notice: Undefined index: memberof in /web/ee_web/include/adLDAP.php on line 762
line 762: if (is_array($groups[0]["memberof"])) {
Also receiving error: Notice: Undefined index: count in /web/ee_web/include/adLDAP.php on line 982
line 982: $entries[0]["memberof"]["count"]++;
Unsure of what I need to do to resolve these error messages, it seems that the script is working fine, but I'd like get rid of these errors.
Using: http://adldap.sourceforge.net/wiki/doku.php?id=api
You could edit the code to something along the lines of:
if(isset($groups[0]["memberof"]))
{
if (is_array($groups[0]["memberof"])){ ... }
}
And
if(isset($entries[0]["memberof"]["count"]))
{
$entries[0]["memberof"]["count"]++;
}
It will keep you from getting the errors, though it won't necessarily handle some pretty lax sanity checking by the original author of the code.
It seems like you have your error_level set to show every possible error/warning/notice, that's why you're getting it.
If the script is working fine, then it's not an error, simply a missing check the coder forgot to put in the library.
To get rid of thos messages, you have 2 options:
a) Use # before the calls you do to that library, such as
$var = #the_function(param1);
This will avoid those messages for just that line.
b) Set the error level to something like this with error_reporting():
error_reporting(E_ALL ^ E_NOTICE);
This will affect the whole script you're running.
It's up to you what to use depending on the project.