Remove HTTP header on Plone error page - plone

I tried to remove HTTP header for Cache-Control on error page of Plone.
I'm using cache setting in Plone control panel, its means added cache-control header at all content types. But I want to remove the header on occurred an error. Because I set long time cache for images but I want to set no-cache at an error.
1st try:
I added tag in default_error_message page template.
dummy_header python:request.RESPONSE.appendHeader('cache-control', '');
2nd try:
I added command in standard_error_message script.
context.REQUEST.RESPONSE.setHeader('cache-control', '')
Please comment or how to fix.

Related

Can't save wordpress guttenberg custom block

I created a custom block, and I faced the issue I've never faced with before. After saving the block and realoding the page, I can see the block disabled and with a warning
This block contains unexpected or invalid content.
And in the console I can see this:
Block validation: Block validation failed
Content generated by 'save' function:
{here is a layout without any value from attributes}
Content retrieved from post body:
{here is a layout with all the data}
So when I log the attributes inside save function they are empty, and WP marks as an error, when the content from the save function does not match to the content posted to the server. Does anyone have any ideas?
When registering a block in JS I forgot to add attributes with selectors. When added, block start working.

Custom 404 Basic Page in Drupal 7 Has Blank Title Tag

I have created a basic page in drupal 7 to use as my 404. I configured under Configuration -> System -> Site Information to use this page and when an unknown URL is entered, it does indeed display this page while maintaining the unknown URL. For SEO purposes, I really want Page Not Found in the html title tags but it is missing. If you go directly to the basic page, the title tags are correct. Is there a setting somewhere that I am missing?
I used the metatag module's configuration for the 404 page to achieve the desired title tags
When you create a any page, you will get node id of the respective page.
In your case, you need to copy page.tpl.php file and rename new file with your node id like for example : page--node--1.tpl.php
Now, put below code in your newly created template file and clear the cache.
if($title) {
print $title;
}

Hide breadcrumb only on 404 page

I created a custom node for 404 page and added the path /node/83 to the site information. And new node is applied. I can't hide (display:none) .breadcrumb to apply to it. I'm trying to do it through css injector and have it apply to only the 404 page. I'm checking it with inspect element and it works and there is only .breadcrumb and i don't see any additional classes that looks like page-404. I added new rule to CSS injector and I don't know what is the path to apply it only to 404 page:
path to not found page
or another idea is to use class that is only applies for 404 page, if there is any by default:
add a class to not found page
Thank you for any help.
Don't hide it in CSS but avoid sending the breadcrumb to the browser.
See https://drupal.stackexchange.com/questions/260304/prevent-path-based-breadcrumb-in-theme-or-dont-show-breadcrumbs-for-403-404-r
Open the 404 page where you'd like to add the CSS rule. Open web inspector and look on the body or html tag for a class that is specific to the page. Something like page-404
Then in your custom CSS add
.page-404 .breadcrumb {
// Your styles
}
This is drupal so Im not to sure if you can do a php check to see if its a 404 page or even if the 404 page has a css class on the body tag if so i would go that way (inspect the element if you can see a class on body that references an error page just target the breadcrumb that way eg, body.error .breadcrumbs {display: none;} if this is not possible take a look at this
https://www.drupal.org/node/15366
Basically this tells you how to make your own 404 page.
Create two nodes, one for each kind of page error (403 and 404).
Determine the ID number of the node you wish to redirect users to. One way to determine the node's ID number is to visit the node and look at the number after the last slash in your browser's address bar. This is your node's ID number.
Now enter the paths to your nodes in the appropriate boxes on your error reporting settings page. For example, if the node ID number for 403 error codes is "83," you would type "node/83" into the "Default 403 (access denied) page" setting.
Drupal 6 mysite.com/admin/settings/error-reporting
Drupal 7 mysite.com/admin/config/system/site-information
Because you are creating nodes, they will show up in the tracker and popular content blocks and anywhere else real nodes would be display. If this isn't acceptable, there is a contributed module called Custom Error that avoids this problem.
Also consider the Drupal 7 contributed module, Redirect 403 to User Login. Which provides redirection to the login page and configurable 403 and 404 error messages.
EDIT
Ok go to sites/all/themes/themename/template.php and edit this file.
add this to the top
function themename_preprocess_page(&$vars) {
// Adds a Custom 404 page
$header = drupal_get_http_header("status");
if($header == "404 Not Found") { ?>
<style>
.your-custom-css-here {}
</style>
<?php }
}

WP error when setting cookie

I get this error when trying to set a cookie on a WP page.
Warning: Cannot modify header information - headers already sent by(...)
Any help here? It worked fine when I did the php outside of wordpress, but when I move it in, it broke. Nothing special about the cookie(very basic).
So how do I get the cookie to set?
You need to set the cookie before any output is sent to the browser. In your theme's functions.php file, add the following hook:
add_action('init', 'my_cookies');
function my_cookies(){
// set cookie here
}
The init hook runs before your template files (header.php, etc) are included. If you try to put your cookie code inside index.php or single.php or whatever template file, you would have to make sure it goes BEFORE get_header(). Once get_header() runs, you've already sent data to the browser, and you cannot modify the headers (which is necessary to modify cookies).
Its possible you are leaking output somewhere else in your code, before the cookie code. If you even echo a space: echo " " somewhere before your cookie code, you'll get that error. If you have a closing php tag ?> with a space after it in one of your files, this gets sent to the browser, and you'll get that error.

Wordpress goes blank after publishing new content?

So out of no where after clicking the publish button the page just goes blank...
The url at the top is:
http://www.brightboxstudios.com/sociabulls/wp-admin/post.php
What's good news is it still posts the content :)
Not great at coding so details rock :)
I was getting same error, when I update the site content and press update it goes to /wp-admin/post.php and this appears as blank page.
It is solved by:
I removed all the spaces at the end of functions.php file, I had included a widget and there were some spaces in between older content and new widget function, when I removed the spaces everything is working fine.
if that don't work then
- go into wp-config.php and find this "define('WP_DEBUG', false);"
change its value, if it is flase, make it true or if it is true change it to false.
And everything must work Good.
Thanks
A blank page usually means Apache failed. Check your error logs. You'll probably find a line that starts with:
PHP Fatal error:
You can also display your errors on the screen instead of looking at the log.
There will be many reasons for blank page, you have not mention version for wp, php etc.
To solve wordpress blank page issue follow the steps
disable all plugin and try (if there is an error in plugins then enable 1 by 1)
switch to default theme and try (if there is an error in theme)
rename .htaccess and param-link to default (page/post id)

Resources