Drupal - White Screen Of Death - drupal

Just changed themes with drupal and I'm left with white screen of death. Default theme which worked was Zen. This is stored under sites/mysite.com/themes
Theme I changed to I think is one of the themes under themes/
Don't have access to the database. Have FTP access.
Is there any way to change themes or install one that will work?

The easiest way to correct your problem is to find what's wrong.
go to index.php and add the following lines after <?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
Then post the error here.
Don't forget to comment/remove when you're done.
EDIT:
If I understood correctly this was what you did before going WSOD.
You were using Zen theme.
You logged into your site with administrator privileges and went to http://yoursite.com/admin
You went to the theme management and changed your theme to another one (henceforth refered as "theme_b")
When refreshed the page (or went to another page in your site) you got the WSOD.
.
If this is true then follow these steps:
Create a blank theme.
In order to do this, create a folder in your computer named "theme_b".
Inside create the following files:
theme_b.info, template.php, style.css and page.tpl.php
Open theme_b.info and paste this:
name = theme_b
description = bla
version = 1
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
Save.
Open page.tpl.php and paste this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<?php print $head ?>
<title><?php print $head_title ?></title>
<?php print $styles ?>
<?php print $scripts ?>
</head>
<body>
<div><?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?></div>
<div><?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?></div>
<div id="sidebar-left" class="sidebar"><?php print $left ?></div>
<div>
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
<?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
<?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
<?php if ($show_messages && $messages): print $messages; endif; ?>
<?php print $help; ?>
</div>
<div>
<?php print $content; ?>
</div>
</body>
</html>
Save.
Then upload the folder theme_a to sites/yoursite.com/themes replacing existing theme_a folder.
This should enable you to access admin section of drupal.

You won't necessarily see any errors. For me it was a caching issue which stopped the page from loading the right content.
I cleared the cache by inserting the following on the last line of my index.php file (in Drupal root). This solved the issue for me:
db_query("DELETE FROM {cache};");
Remember to remove the line again afterwards.
More information about caching, look here: https://drupal.org/node/42055

It's most probably a PHP silent death because there's not enough memory allocated to scripts in /etc/php.ini
On shared hosting environments, you MAY be able to override this using a .htaccess file.

You more than likely have a PHP error that isn't being shown because error reporting is turned off by default on your host. The easiest way to remedy this is to add the following code at the top of index.php:
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
Additionally, you definitely want to locate your php error logs and see if there is any additional information regarding the error there.
Checkout the Drupal help page for this topic: http://drupal.org/node/158043

Related

Open ad clicking anywhere in wordpress

I have wordpress site and I'm using this script
onclick="<?php if(!isset($_COOKIE['visited'])){echo"window.open('http://link', '_blank')"; setcookie("visited", "1", time()+3600*24); header("Refresh:0");} ?>"
in body line. So it means I'm using
<body <?php body_class(); ?> onclick="<?php if(!isset($_COOKIE['visited'])){echo"window.open('http://link', '_blank')"; setcookie("visited", "1", time()+3600*24); header("Refresh:0");} ?>">
on header.php file of the theme.
But it opens the link in every click.
I want to open it only one time until I refresh the page or open new page.
How can I do it.
Please help.
Thanks in advance.
Greetings.
Like the setcookie function reference says:
cookies must be sent before any output from your script
First solution
You could add this at the very top oh header.php:
<?php
$onclick = '';
if(!isset($_COOKIE['visited'])) {
setcookie('visited', '1', time()+3600*24, COOKIEPATH, COOKIE_DOMAIN);
$onclick = 'onclick="window.open(\'http://link\', \'_blank\')"';
}
?>
Update: I've added the constants COOKIEPATH and COOKIE_DOMAIN like explained here.
And this for your body tag:
<body <?php body_class(); ?> <?php echo $onclick; ?>>
Better solution
The prior solution doesn't ensure the cookie is set before any output sent (there could be some characters in one of you template files before get_header() is called, or a plugin could add something).
Instead you should add an action to a Wordpress hook that is always called before any output (like init).
So try adding to your functions.php file:
add_action('init', 'set_visited_cookie');
function set_visited_cookie() {
if (!isset($_COOKIE['visited'])) {
setcookie('visited', '1', strtotime('+1 day'), COOKIEPATH, COOKIE_DOMAIN);
}
}
As for your body tag:
<body <?php body_class(); ?> <?php if(!isset($_COOKIE['visited'])): ?> onclick="window.open('http://link', '_blank')" <?php endif; ?>>

Wrong media files url on WordPress site

I have met a problem on WordPress site:
None images uploaded as media files are showing. I see they have wrong url like this
<a class="thumbLink" href="http:///wp-content/uploads/2014/10/Joseph-Angharad-11.7.2014-271.jpg" rel="prettyPhoto[gallery1]" title=""><i class="icon-search"></i></a>
I've tried to upload new media files and they get similar url and don't displayed.
In the database it seems ok. I don't see such url in it.
Have you met such a problem? Where to look resolving?
As far as I know it happened before removing a plugin (which was inactive).
I get images via the following code:
// instantiate the controller
if (!function_exists("peTheme")) {
$peThemeClassName = apply_filters('pe_theme_controller_classname','PeTheme'.PE_THEME_NAME);
PeGlobal::$controller =& new $peThemeClassName();
function &peTheme() {
return PeGlobal::$controller;
}
peTheme()->boot();
}
<?php $t =& peTheme(); ?>
<section class="thumbImage">
<img src="<?php echo $t->image->resizedImgUrl($content->get_origImage(),350,0); ?>" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle"><?php $content->title(); ?></h3>
<?php
$text = get_the_excerpt();
if (strlen($text) > 40)
$text = substr($text, 0, 40) . '...';
echo '<p>' . $text . '</p>';
?>
<?php while ($slide =& $slider->next()): ?>
<?php $img = $slide->img; ?>
<?php
if ( $first ) {
?>
<a class="thumbLink" href="<?php echo $img; ?>" rel="prettyPhoto['<?php $content->slug(); ?>']" title=""><i class="icon-search"></i></a>
<?php
$first = false;
} else {
?>
<?php
}
<?php endwhile; ?>
</div>
</div>
</section>
It quite silly of me but I didn't disable plugins to check.
The problem was in a Parallelize plugin. It has been disabled and from now media files have right url.
This post may be a little outdated, but I had a similar recent issue so in case it proves useful to anyone:
To start, I had previously changed the Wordpress upload directory by adding the following to the end of wp-config.php
define( 'UPLOADS', ''.'files' );
So all my files are saved in domain.com/files/ After upgrading to Wordpress 4.5, all media files had very wrong url, (with something crazy like .../wp-content/uploads/rootuser/public_html/wp-content/uploads...) I tried reinstalling Wordpress, changing the directory again, disabling plugins, then I found a few posts about the Search & Replace working for some, but still no luck.
Then I found this plugin, Upload Url and Path Enabler and used the following settings that suited my situation:
Store Files: files
Full File URL: http://www.domain.com/files
And presto! All media URLs magically updated and all is working again!

Where is $title set in drupal views files?

I am working on a drupal 6 site and I am dealing with a views template file which overrides views-view-table.tpl.php. The first few lines of code are:
<table class="<?php print $class; ?>">
<?php if (!empty($title)) : ?>
<caption><?php print $title; ?></caption>
<?php endif; ?>
Where is $title set and what is it? It doesn't seem to be the node id. In the site I am working one, its displaying one of the fields!
It's the title of the View Display (not the machine name of the View!)
See left top corner of the Views Admin UI.

php logo call in block - Drupal 7

I am building out a site in drupal 7 and running into a ton of problems... very new to drupal here.
I pulled the php call for the logo out of the page.tpl file and put into the header block to be added to all pages. I understand I should probably just leave it in the page.tpl file but thought it made sense to utilize the header block but it is no longer working. can someone explain why this is not working?
here is the code
<div id="logo"><?php if ($logo): ?>
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
<?php endif; ?></div>
It's because the variable $logo is not available in block.tpl.php, it is provided only to page.tpl.php.
You can actually grab the values yourself like this:
$theme_name = 'name_of_theme';
$settings = variable_get('theme_' . $theme_name . '_settings', array());
if (isset($settings['logo_path'])) {
$logo = file_create_url($settings['logo_path']);
}
all what you need, it's additions in template.php this code
function hook_preprocess_region(&$variables) {
$variables['logo'] = theme_get_setting('logo');
$variables['front_page'] = variable_get('site_frontpage', 'node');
}
clear cache
and $logo and $front_page will works good.

Views title is blank

I'm using the Drupal views module to create an overview of nodes. In the view i created i configured the Title. But now when the page is rendered the title isn't shown. It is shown in the breadcrumb etc. But not in the grid template, also if i use another template it still doesn't show. Any idea what this can be? I tried looking for it, but my experience with Drupal is very limited.
I checked the drupal_get_title etc. and it is always returning the title, i think something goes wrong in the views module, but i don't know what :s
Kind regards,
Daan
The problem is most likely how you print the page title. If you want it to happen globally, you should print it in the page.tpl.php. Have you inspected the $title variable in the page template? That is what it's usually called.
i idd removed the title from page.tpl.php, but i did this because i thought it should be printed in the views template. When you check views-view-unformatted.tpl.php etc you see this:
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div class="<?php print $classes[$id]; ?>">
<?php print $row; ?>
</div>
<?php endforeach; ?>
so i thought $title would print the title, but it is fixed just by adding it in my page.tpl.php

Resources