Loading...
 
 Error
  • Contact the site administrator. The index needs rebuilding.
Architecture / Installation

Architecture / Installation


Screen White-Out After Custom Code Additions in "Look&Feel/Customisation"

posts: 7 United Kingdom

What I did
I added some custom html code on the "Look and Feel / Customisation" page, (in the box where it says 'Custom code just before the closing tag') After adding the custom code, the site will only display a white screen.

What I want to do
I want help to undo these custom code changes so that I can access the site again.

How to proceed?
Would I be correct in assuming I need to make some changes to "tiki-admin.php?"

I've not been using Tikiwiki for long, just a few months. Anyone that can point me in the right direction and help me learn would be much appreciated.

Thomas
(webwoven)

posts: 44 Canada

I think something wrong in your custom code must be causing a fatal error. Are you able to run the following command in your MySQL database to clear it out?

update tiki_preferences set value="" where name="feature_endbody_code";


If you are unable to do that, you could look in templates/footer.tpl and temporarily remove the line {eval var=$prefs.feature_endbody_code} close to the end and put it back after you've cleared it out in the admin panel.

(by the way I found the internal pref name "feature_endbody_code" by searching within the "lib/prefs" directory using grep but any tool that searches within all files in a directory would work. You can also see the pref name in the source of the admin panel itself - and it is shown when you save a pref - but if you can't get to the admin panel that doesn't help)


posts: 7 United Kingdom

Not having the confidence/skill to try the first option, I opted instead for the second suggestion and removed the line {eval var=$prefs.feature_endbody_code} from templates/footer.tpl

Then I logged into the site admin panel and removed the custom code.

Finally I restored the line {eval var=$prefs.feature_endbody_code} to templates/footer.tpl

Now the site is working fine.



I should say I am extremely grateful for your suggestion. As a fairly new user, making this change has given me confidence to use Tiki at a deeper level.


posts: 7 United Kingdom

Update
Having fixed up the bad code in the custom footer box...

(Settings/Control Panels/Look&Feel/Customisation/Custom-Code-Just-Before-Closing)

...I then managed to produce some more bad custom code in the custom header box...

"(Settings/Control Panels/Look&Feel/Customisation/Custom-HTMLContent)"

...and this caused the same problem again with a screen white-out.

Fix
To fix this, I used a similar method to that suggested previously:

First I located the file templates/header.tpl

Then I removed the line: {eval var=$prefs.feature_custom_html_head_content}

The site then worked as usual and I proceeded to remove the bad code from the custom header box before replacing the line {eval var=$prefs.feature_custom_html_head_content} in templates/header.tpl



Having encountered the above situations, now I am making custom code changes on a test site first before implementing on the main site. This is fine, but I kind of wish Tiki was a bit more forgiving towards my bad coding. confused


posts: 2428 Czech Republic

Hi Thomas,

if your code contains curly brackets (rather common in JavaScript code) these custom code textareas interpret them as if they were Smarty syntax (sadly it uses curly brackets too).

To avoid this issue wrap your code inside
Copy to clipboard
{literal}...{/literal}
Smarty block and it should be fine (no more WSODs).


You may ask why do not we make that by default? It is so because sometimes you really want custom Smarty syntax there to do various kind of conditional checks and tricks using Smarty ;)

HTH,
luci


posts: 7 United Kingdom

Luci,

I applied your suggestions and have experienced much improved results.

This is appreciated.

Thomas ~