**help** - how to undo error in page defaults
Permalink
Hi there, I was just editing a 'php block' in the page types default, but I obviously mistyped something in my code as it's telling me:
Fatal error: Call to a member function getRelativePath()
Trouble is, I can't figure out how to undo my edit as I can't go back into the page type defaults page to re-edit... Is it possible to undo my edit? If so, how can I do this?
**UPDATE**
I don't think there was a problem with my code, as old pages and newly created ones still work. There is obviously a conflict with my code within the dashboard page to display the page defaults. Still, I need to rectify so that I can go back in there.
The page is product_detail within the eCommerce package :(
Fatal error: Call to a member function getRelativePath()
Trouble is, I can't figure out how to undo my edit as I can't go back into the page type defaults page to re-edit... Is it possible to undo my edit? If so, how can I do this?
**UPDATE**
I don't think there was a problem with my code, as old pages and newly created ones still work. There is obviously a conflict with my code within the dashboard page to display the page defaults. Still, I need to rectify so that I can go back in there.
The page is product_detail within the eCommerce package :(
Thanks for this.
I rectified the problem by using the if staement and also to check which page was being edited using
This works fine for my purpose as it is the only page affected by my code which incidently was about retrieving thumbnail information and subsequently getting the info from the source file:
It was the bit about getting $src = $img->getRelativePath(); which was causing the error in the Page Defaults Edit
Anyway, sorted now. Thanks for your help
Rob
I rectified the problem by using the if staement and also to check which page was being edited using
global $c; if (($c->isEditMode()) || ($_GET['cID'] == '123')) { ?> <div style="color:#fff;background:#999;">Product Header in Edit Mode</div> <? } else { *** code goes here *** }
This works fine for my purpose as it is the only page affected by my code which incidently was about retrieving thumbnail information and subsequently getting the info from the source file:
$img = Page::getCurrentPage()->getAttribute('thumbnail'); $src = $img->getRelativePath(); $size = @getimagesize($img->getPath()); $width = $size[0]; $height = $size[1];
It was the bit about getting $src = $img->getRelativePath(); which was causing the error in the Page Defaults Edit
Anyway, sorted now. Thanks for your help
Rob
Read this article: Tips for getting forum questions answered (by MrKDilkington):
http://documentation.concrete5.org/tutorials/tips-getting-forum-que...
You talk about "vivid_product" --> view.php
Plus:
Did you add some custom attributes (like thumbnail)? Or change the core block code?
Sometimes in defaults area you have objects that only declare in the "page" level (Like some topic or thumbnail you declare in the composer) - When you create new page you declare this dangerous "throw-error" "non" object element maybe in the composer, so you dont get any errors.
Wrong code like this:
Line 2 - will throw error:
Why?
Read this:http://www.w3schools.com/php/php_datatypes.asp...
How to solve this problem?
http://www.tutorialspoint.com/php/php_decision_making.htm...
You must!! add some "if" statements to check if "this is object" --> Yes --> do something. No : do something.
** Look at the core blocks view.php like "image" or "page-slider" to see this idea in normal example.
C5 forum post about similar issue (i guess again your Q its really general):
https://www.concrete5.org/community/forums/usage/conditional-image-t...
---- If this not solve your problem ---
Under this location:
siteName/index.php/dashboard/system/environment/debug
Active this:
"Show the debug error output" --> than add some screen shot