| Project: | Dynamic display block |
| Version: | 6.x-1.0-rc6 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Issue Summary
Hi,
I really like the potential of this module, but I just can't seem to get the advanced slide show working. I've walked through the advanced tutorial and followed all of those steps to make the content type and view. But I'm having a problem.
In Firefox, I get the slider text, the read more button, and the pager item text, but I don't get any image. In Internet Explorer 7, I just get a gray box, no slider text, no button, no pager text, no image. I uncommented the debug lines in my template.php file and the following was outputted:
array (
'delta' => '3',
'output_type' => 'view_fields',
'pager' => 'custom-pager',
'pager_container' => NULL,
'pager_event' => NULL,
'pager_height' => 63,
'pager_width' => 195,
'imgcache_pager_item' => '',
'pager_position' => 'top',
'template' => 'upright50',
'custom_template' => NULL,
'view_name' => 'news_items',
)
stdClass::__set_state(array(
'nid' => '72',
'node_title' => 'Red Dodge Viper',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'Red Viper',
'node_data_field_pager_item_text_nid' => '72',
'node_type' => 'ddblock_news_item',
'node_data_field_pager_item_text_field_slide_text_value' => 'This is a red Dodge Viper',
'node_data_field_pager_item_text_field_image_fid' => '8',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'This is the second try and a news item content type with a red Dodge Viper instead of a blue one. We shall see if this works... I have my doubts.',
'node_revisions_format' => '1',
'node_created' => '1237990114',
))
I attached a screen shot of how it looks in Firefox and how it looks in IE7. I've also attached my template.php file. Any suggestions you have would be greatly appreciated.
| Attachment | Size |
|---|---|
| firefoxSS.JPG | 20.98 KB |
| ie7SS.JPG | 14.29 KB |
| template.php.txt | 11.8 KB |
Comments
#1
Thanks for sending the template.php file and the result of the drupal_set_message debug lines
Due to changes in the filefield and imagfield modules The cck variables are different depending on the version you have installed.
In your case, to show the images in the ddblock slideshow, you need to change all occurrences of:
node_data_field_image_field_image_fidto
node_data_field_pager_item_text_field_image_fidHope this helps you further, please let me know.
#2
Thank you so much! I changed those lines and it works like a charm now.
#3
set status to fixed
#4
Automatically closed -- issue fixed for 2 weeks with no activity.
#5
I have been dealing with this prblem for over 2 weeks and today was the day I was going to give up. Iam glad I found this link because I was having the same problem.
I am glad that I found a fix for the problem but it should not be this hard. Somehow this information
should be added as part of the documentation.
Thanks,
Néstor :-)
#6
@quindio
Thanks for pointing out, it is not always easy for users to find existing solutions for issues.
I made the reference to the FAQ on ddblock.myalbums.biz in red in the major tutorial pages and added to look at the trouble shooting part of the faq.
I hope users can find known solutions for issues better now.
#7
@ ppblaauw
Thank you for this module, I really like it.
Now I met the similar problems, and I have try to fix following the steps you provide, and I fixed parts, but here is another issue appearing, only the small pictures displaying, but the main pictures not displaying..
Here is my template.php and the screenshot.
I am new at Drupal..
Waiting for your response
#8
@jiangqiqi77
I see one pager-item image.
The slideshow needs at least two nodes to work.
Hope this helps you further, please let me know.
#9
I am still facing the same same problem.. Grey area in the box. Here is a link to my site:
http://www.gooverseas.com
#10
@ dunklea
Please have a look at the faq question: Images not showing, only grey box.
If you can not solve it yourself, attach the result of the drupal_set_message lines, so I can help you better.
Hope this helps you further, please let me know.
#11
Hello,
I have the same problem, but in my case the image isn't just listed in the drupal_set_message. I paste here the result:
'news_items'
stdClass::__set_state(array(
'nid' => '3577',
'node_title' => 'Sobre molinos, gigantes y sabios encantadores',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'Don Quijote',
'node_type' => 'story',
'node_vid' => '3579',
'node_data_field_pager_item_text_field_slide_text_value' => 'En esto descubrieron treinta o cuarenta molinos de viento que hay en aquel campo',
'node_created' => '1257212191',
))
Any ideas?
Thanks in advance!
#12
#11
Did you enable the Content Permissions module (CCK - submodule)?
Did you give permission for the field you use in your slideshow block?
Can you send the content of the template.php file?
Can you send a link to the site?
Please provide this information so I can help you better.
Hope this helps you further, please let me know.
#13
Thanks for your answer. I did not enable the Content Permissions module. Should I?
Here's the content of my template.php file. Note my theme is a subtheme of ZEN/The Morning After.
<?php
/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.6 (01-OCT-2009)
* Licenced under GPL license
* http://www.gnu.org/licenses/gpl.html
*/
/**
* Override or insert variables into the ddblock_cycle_block_content templates.
* Used to convert variables from view_fields to slider_items template variables
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function Panorama_preprocess_ddblock_cycle_block_content(&$vars) {
if ($vars['output_type'] == 'view_fields') {
$content = array();
// Add slider_items for the template
// If you use the devel module uncomment the following line to see the theme variables
// dsm($vars['settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following line to see the theme variables
drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
if ($vars['settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
// get image id
$fid = $result->node_data_field_pager_item_text_field_image_fid;
// get path to image
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'<img src="' . base_path() . $filepath .
'" alt="' . check_plain($result->node_title) .
'"/>';
}
}
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['slider_items'] = $slider_items;
}
}
/**
* Override or insert variables into the ddblock_cycle_pager_content templates.
* Used to convert variables from view_fields to pager_items template variables
* Only used for custom pager items
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function Panorama_preprocess_ddblock_cycle_pager_content(&$vars) {
if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
$content = array();
// Add pager_items for the template
// If you use the devel module uncomment the following lines to see the theme variables
// dsm($vars['pager_settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following lines to see the theme variables
drupal_set_message('<pre>' . var_export($vars['pager_settings'], true) . '</pre>');
drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
if ($vars['pager_settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_field_image_fid;
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') &&
is_array(imagecache_presets()) &&
$vars['imgcache_pager_item'] <> '<none>'){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'<img src="' . base_path() . $filepath .
'" alt="' . check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value) .
'"/>';
}
}
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}
The test address where you can reach my block is: http://panoramacatolico.info/pagina/pruebas
Thanks again!
#14
Thank you for the detailed information.
You don't need to enable the Content permission module, only if you want to give permission per field.
The template.php file looks ok.
Did you add the image_field in the content of the view?
Can you send the preview of the SQL statement in your view?
Hope this helps you further, please let me know.
#15
Here's the SQL result:
SELECT node.nid AS nid, node.title AS node_title, node_data_field_pager_item_text.field_pager_item_text_value AS node_data_field_pager_item_text_field_pager_item_text_value, node.type AS node_type, node.vid AS node_vid, node_data_field_pager_item_text.field_slide_text_value AS node_data_field_pager_item_text_field_slide_text_value, node.created AS node_created FROM node node INNER JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN content_type_story node_data_field_pager_item_text ON node.vid = node_data_field_pager_item_text.vid WHERE (node.status <> 0) AND (term_node.tid = 1) ORDER BY node_created DESCAgain, thanks very much!
#16
#15
In the preview of the SQL result in the view, seems like you don't have a field for your image.
Can you give admin access to your site, so i can help you better?
You can send it to my contact form.
#17
#15
I had a look at the site. For your image field you checked Group multiple values.
This needs to be unchecked, now you could see the image field variable in the view.
In the preprocess functions you need to change
node_data_field_pager_item_text_field_image_fid4 times to
node_data_field_image_field_image_fidHope this helps you further, please let me know.
#18
Thanks very much!
#19
Hello,
I have the same problem. I am using the theme acquia_slate. Can you please help me what I am doing wrong?
For the template i copy the following code in the exiting acquia_slate template file:
Also this error occurs every time:
warning: Invalid argument supplied for foreach() in /storage/mijndomein/users/019772/public/sites/richard.trendiescadeau.nl/sites/all/themes/acquia_slate/custom/modules/ddblock/ddblock-cycle-block-content-upright50.tpl.php on line 47.
function slideshow_preprocess_ddblock_cycle_block_content(&$vars) {
node_title) .
node_data_field_pager_item_text_field_pager_item_text_value) .
if ($vars['output_type'] == 'view_fields') {
$content = array();
// Add slider_items for the template
// If you use the devel module uncomment the following line to see the theme variables
// dsm($vars['settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following line to see the theme variables
// drupal_set_message('' . var_export($vars['settings']['view_name'], true) . '');
// drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
// get image id
$fid = $result->node_data_field_pager_item_text_field_image_fid;
// get path to image
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> ''){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'
'"/>';
}
}
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['slider_items'] = $slider_items;
}
}
/**
* Override or insert variables into the ddblock_cycle_pager_content templates.
* Used to convert variables from view_fields to pager_items template variables
* Only used for custom pager items
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function slideshow_preprocess_ddblock_cycle_pager_content(&$vars) {
if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
$content = array();
// Add pager_items for the template
// If you use the devel module uncomment the following lines to see the theme variables
// dsm($vars['pager_settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following lines to see the theme variables
// drupal_set_message('' . var_export($vars['pager_settings'], true) . '');
// drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['pager_settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_field_image_fid;
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') &&
is_array(imagecache_presets()) &&
$vars['imgcache_pager_item'] <> ''){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'
'"/>';
}
}
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}
The SQL-view is:
SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_pager_item_text.field_pager_item_text_value AS node_data_field_pager_item_text_field_pager_item_text_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_pager_item_text.field_slide_text_value AS node_data_field_pager_item_text_field_slide_text_value,
node_data_field_pager_item_text.field_image_fid AS node_data_field_pager_item_text_field_image_fid,
node_data_field_pager_item_text.field_image_list AS node_data_field_pager_item_text_field_image_list,
node_data_field_pager_item_text.field_image_data AS node_data_field_pager_item_text_field_image_data,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format,
node.created AS node_created
FROM node node
LEFT JOIN content_type_ddblock_news_item node_data_field_pager_item_text ON node.vid = node_data_field_pager_item_text.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.status <> 0) AND (node.type in ('ddblock_news_item'))
ORDER BY node_created ASC
Thanks a lot for the solution,
Richard
#20
#19
In your preprocess functions you need to use the themename you use so the preprocess functions become:
function acquia_slate_preprocess_ddblock_cycle_block_content(&$vars) {function acquia_slate_preprocess_ddblock_cycle_pager_content(&$vars) {after making the changes, clear the cache at administer > site configuration > performance
Hope this helps you further, please let me know.
#21
Thanks a lot.... That was the problem...
Richard
#22
Hi,
I have the same problem.
Grey box + invalid argument... error in the advanced dd block configuration.
I posted more than 1 node, set all permissions (even at filesystem level), read all faqs and tried to apply the solutions given in other issues.
My site is http://naty.netsons.org/untaxiper/
See attached file for template.
Thank you for you help
#23
#24
#22 the name of the view is case sensitive:
You use:
News_itemfor your view, but in the preprocess functions you use:
news_itemHope this helps you further, please let me know.
#25
Thank you for quick reply.
Now the dynamic block works, but images dont' show up yet, (while relative texts work properly). There is still a grey box at their place.
You can check: http://naty.netsons.org/untaxiper
Thanks in advance.
#26
I had a look at the site.
In the preprocess functions you need to change
node_data_field_image_field_image_fid4 times to
node_data_field_pager_item_text_field_image_fidHope this helps you further, please let me know.
#27
That's perfect, thank you very much!
#28
set status to fixed
#29
Automatically closed -- issue fixed for 2 weeks with no activity.
#30
Hi!
I've been trying to solve the same problem that everyone here faced (can't see any images in my slideshow, only the title of theme) and after trying all the solutions posted here I couldn't manage to resolve my problem. I need some help please!
I already tried to change
node_data_field_image_field_image_fid
to
node_data_field_pager_item_text_field_image_fid
and the other way around but still can't see my ddblock images.
I've attached my template.php and here is a link to my website http://luandanoticias.com
The slide show is at the bottom of the page
thanks!
#31
Can you uncomment the drupal_set_message debug lines in the toasted_preprocess_ddblock_cycle_block_content preprocess function, to see which fieldname CCK generated for the image field?
#32
ok you can now see the debug lines in the page. here is a new template.txt because i think the one that i sent before was wrong.
#33
As you can see the name of the image-field needs to be: node_data_field_image_field_image_fid
Change in the content preprocess function in your template.php file (2 times)
node_data_field_pager_item_field_image_fidinto
node_data_field_image_field_image_fidHope this helps you further, please let me know.
#34
It worked! thanks a lot. I think something in the text area is missing, i will try to figure it out.
#35
Finaly everything works fine. i don't know why but the image file in the custom directory, where the readmore.png and the transparent_bg.png should be, was missing. I had to create one.
Thanks a lot again!
#36
Great it works now!
Changed issue title
#37
hi, i am having issue in IE, the test slider is not showing up in IE7, it is working in all other browsers. can you please help?
thanks
#38
#37 You really need to give more information.
Tips:
You can search the issue queue for other similar issues, search on all issues (also the closed ones).
This way you can find direct answers. The module also has a FAQ page.
You can read more in the Issue queue handbook to make you posts in issue queues and your journey with Drupal more fruitful.
#39
I'm getting a Empty gray box too, I haven't content premissions enabled, How should I do the changes mentioned in #1 comment?
my template.php
// $Id: template.php,v 1.1.2.3 2009/11/05 03:32:15 sociotech Exp $
/**
* Changed breadcrumb separator
*/
function acquia_prosper_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' ← ', $breadcrumb) .'</div>';
}
}
/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.6 (01-OCT-2009)
* Licenced under GPL license
* http://www.gnu.org/licenses/gpl.html
*/
/**
* Override or insert variables into the ddblock_cycle_block_content templates.
* Used to convert variables from view_fields to slider_items template variables
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function acquia_prosper_preprocess_ddblock_cycle_block_content(&$vars) {
if ($vars['output_type'] == 'view_fields') {
$content = array();
// Add slider_items for the template
// If you use the devel module uncomment the following line to see the theme variables
// dsm($vars['settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following line to see the theme variables
// drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
// drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
if ($vars['settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
// get image id
$fid = $result->node_data_field_pager_item_text_field_image_fid;
// get path to image
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'<img src="' . base_path() . $filepath .
'" alt="' . check_plain($result->node_title) .
'"/>';
}
}
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['slider_items'] = $slider_items;
}
}
/**
* Override or insert variables into the ddblock_cycle_pager_content templates.
* Used to convert variables from view_fields to pager_items template variables
* Only used for custom pager items
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function acquia_prosper_preprocess_ddblock_cycle_pager_content(&$vars) {
if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
$content = array();
// Add pager_items for the template
// If you use the devel module uncomment the following lines to see the theme variables
// dsm($vars['pager_settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following lines to see the theme variables
// drupal_set_message('<pre>' . var_export($vars['pager_settings'], true) . '</pre>');
// drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
if ($vars['pager_settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_field_image_fid;
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') &&
is_array(imagecache_presets()) &&
$vars['imgcache_pager_item'] <> '<none>'){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'<img src="' . base_path() . $filepath .
'" alt="' . check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value) .
'"/>';
}
}
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}
news-item veiw query :
SELECT node.nid AS nid,node.title AS node_title,
node.language AS node_language,
node_data_field_pager_item_text.field_pager_item_text_value AS node_data_field_pager_item_text_field_pager_item_text_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_slide_text.field_slide_text_value AS node_data_field_slide_text_field_slide_text_value,
node_data_field_image.field_image_fid AS node_data_field_image_field_image_fid,
node_data_field_image.field_image_list AS node_data_field_image_field_image_list,
node_data_field_image.field_image_data AS node_data_field_image_field_image_data,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format,
node.created AS node_created
FROM node node
LEFT JOIN content_field_pager_item_text node_data_field_pager_item_text ON node.vid = node_data_field_pager_item_text.vid
LEFT JOIN content_field_slide_text node_data_field_slide_text ON node.vid = node_data_field_slide_text.vid
LEFT JOIN content_field_image node_data_field_image ON node.vid = node_data_field_image.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.status <> 0) AND (node.type in ('review'))
ORDER BY node_created ASC
thanks in advance!
#40
In your case the image field name should be: node_data_field_image_field_image_fid.
I changed 4 x
(node_data_field_pager_item_text_field_image_fid) into (node_data_field_image_field_image_fid)
I added a <?php tag at the top of your template file. (maybe you just did not copy it).
Attached the template.php__2.txt file.
Needs to be renamed to template.php again.
Hope this helps you further, please let me know.
#41
Thanks for your help and time :) it solved my problem , but I still don't get Slide text on ddblock-news item slide show block , I think it might be for my site being rtl, just guessing! :P Does this (great) module support rtl?
#42
@41 you have a link to the Internet site, so I can help you better?
#43
www.digidesk.ir , thank you so much!
#44
The ddblock module works with RTL Internet sites.
In the template.php file
in the part:
// add slide_text variableif (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
node_data_field_pager_item_text_field_slide_text_valueneeds to be changed 2x in
node_data_field_slide_text_field_slide_text_valueHope this helps you further, please let me know.
#45
Thank you so much ppblaauw , everything's working fine now :)
#46
Automatically closed -- issue fixed for 2 weeks with no activity.
#47
Hello,
First of all, thanks for all your help and the great job developing this module. I have been some time trying to make this module work without success, and apparently I don't have any of the mistakes above... which is to say that probably I am making a more basic mistake; I would appreciate any insight. After following as closely as I could all the instructions I am just seeing the node titles on the page specified to show the slides and a piece of php code. This is the website page: http://krs.kadchi.com/node/11.
And my template.php:
(Since I don't have any formal training as programmer, I don't quite understand the part about uncommenting)
<?php
// $Id: template.php,v 1.1.2.8 2009/05/13 11:26:06 jwolf Exp $
/**
* Initialize theme settings
*/
if (is_null(theme_get_setting('user_notverified_display')) || theme_get_setting('rebuild_registry')) {
// Auto-rebuild the theme registry during theme development.
if(theme_get_setting('rebuild_registry')) {
drupal_set_message(t('The theme registry has been rebuilt. Turn off this feature on production
websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
}
global $theme_key;
// Get node types
$node_types = node_get_types('names');
/**
* The default values for the theme variables. Make sure $defaults exactly
* matches the $defaults in the theme-settings.php file.
*/
$defaults = array(
'user_notverified_display' => 1,
'breadcrumb_display' => 0,
'search_snippet' => 1,
'search_info_type' => 1,
'search_info_user' => 1,
'search_info_date' => 1,
'search_info_comment' => 1,
'search_info_upload' => 1,
'front_page_title_display' => 'title_slogan',
'page_title_display_custom' => '',
'other_page_title_display' => 'ptitle_slogan',
'other_page_title_display_custom' => '',
'configurable_separator' => ' | ',
'meta_keywords' => '',
'meta_description' => '',
'taxonomy_display_default' => 'only',
'taxonomy_format_default' => 'vocab',
'taxonomy_enable_content_type' => 0,
'submitted_by_author_default' => 1,
'submitted_by_date_default' => 1,
'submitted_by_enable_content_type' => 0,
'readmore_default' => t('Read more'),
'readmore_title_default' => t('Read the rest of this posting.'),
'readmore_prefix_default' => '',
'readmore_suffix_default' => '',
'readmore_enable_content_type' => 0,
'comment_singular_default' => t('1 comment'),
'comment_plural_default' => t('@count comments'),
'comment_title_default' => t('Jump to the first comment of this posting.'),
'comment_prefix_default' => '',
'comment_suffix_default' => '',
'comment_new_singular_default' => t('1 new comment'),
'comment_new_plural_default' => t('@count new comments'),
'comment_new_title_default' => t('Jump to the first new comment of this posting.'),
'comment_new_prefix_default' => '',
'comment_new_suffix_default' => '',
'comment_add_default' => t('Add new comment'),
'comment_add_title_default' => t('Add a new comment to this page.'),
'comment_add_prefix_default' => '',
'comment_add_suffix_default' => '',
'comment_node_default' => t('Add new comment'),
'comment_node_title_default' => t('Share your thoughts and opinions related to this posting.'),
'comment_node_prefix_default' => '',
'comment_node_suffix_default' => '',
'comment_enable_content_type' => 0,
'rebuild_registry' => 0,
);
// Make the default content-type settings the same as the default theme settings,
// so we can tell if content-type-specific settings have been altered.
$defaults = array_merge($defaults, theme_get_settings());
// Set the default values for content-type-specific settings
foreach ($node_types as $type => $name) {
$defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
$defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
$defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
$defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
$defaults["readmore_{$type}"] = $defaults['readmore_default'];
$defaults["readmore_title_{$type}"] = $defaults['readmore_title_default'];
$defaults["readmore_prefix_{$type}"] = $defaults['readmore_prefix_default'];
$defaults["readmore_suffix_{$type}"] = $defaults['readmore_suffix_default'];
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
// Get default theme settings.
$settings = theme_get_settings($theme_key);
// If content type-specifc settings are not enabled, reset the values
if (!$settings['readmore_enable_content_type']) {
foreach ($node_types as $type => $name) {
$settings["readmore_{$type}"] = $settings['readmore_default'];
$settings["readmore_title_{$type}"] = $settings['readmore_title_default'];
$settings["readmore_prefix_{$type}"] = $settings['readmore_prefix_default'];
$settings["readmore_suffix_{$type}"] = $settings['readmore_suffix_default'];
}
}
if (!$settings['comment_enable_content_type']) {
foreach ($node_types as $type => $name) {
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
}
// Don't save the toggle_node_info_ variables
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_'. $type]);
}
}
// Save default theme settings
variable_set(
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
array_merge($defaults, $settings)
);
// Force refresh of Drupal internals
theme_get_setting('', TRUE);
}
/**
* Modify theme variables
*/
function phptemplate_preprocess(&$vars) {
global $user; // Get the current user
$vars['is_admin'] = in_array('admin', $user->roles); // Check for Admin, logged in
$vars['logged_in'] = ($user->uid > 0) ? TRUE : FALSE;
}
function phptemplate_preprocess_page(&$vars) {
// Remove sidebars if disabled
if (!$vars['show_blocks']) {
$vars['sidebar_first'] = '';
$vars['sidebar_last'] = '';
}
// Build array of helpful body classes
$body_classes = array();
$body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in'; // Page user is
logged in
$body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; // Page is
front page
if (isset($vars['node'])) {
$body_classes[] = ($vars['node']) ? 'full-node' : ''; // Page is
one full node
$body_classes[] = (($vars['node']->type == 'forum') || (arg(0) == 'forum')) ? 'forum' : ''; // Page is
Forum page
$body_classes[] = ($vars['node']->type) ? 'node-type-'. $vars['node']->type : ''; // Page has
node-type-x, e.g., node-type-page
}
else {
$body_classes[] = (arg(0) == 'forum') ? 'forum' : ''; // Page is
Forum page
}
$body_classes[] = (module_exists('panels_page') && (panels_page_get_current())) ? 'panels' : ''; // Page is
Panels page
$body_classes[] = 'layout-'. (($vars['sidebar_first']) ? 'first-main' : 'main') . (($vars['sidebar_last']) ? '-last' :
''); // Page sidebars are active
if ($vars['preface_first'] || $vars['preface_middle'] || $vars['preface_last']) { // Preface
regions are active
$preface_regions = 'preface';
$preface_regions .= ($vars['preface_first']) ? '-first' : '';
$preface_regions .= ($vars['preface_middle']) ? '-middle' : '';
$preface_regions .= ($vars['preface_last']) ? '-last' : '';
$body_classes[] = $preface_regions;
}
if ($vars['postscript_first'] || $vars['postscript_middle'] || $vars['postscript_last']) { // Postscript
regions are active
$postscript_regions = 'postscript';
$postscript_regions .= ($vars['postscript_first']) ? '-first' : '';
$postscript_regions .= ($vars['postscript_middle']) ? '-middle' : '';
$postscript_regions .= ($vars['postscript_last']) ? '-last' : '';
$body_classes[] = $postscript_regions;
}
$body_classes = array_filter($body_classes); // Remove empty
elements
$vars['body_classes'] = implode(' ', $body_classes); // Create class
list separated by spaces
// Add preface & postscript classes with number of active sub-regions
$region_list = array(
'prefaces' => array('preface_first', 'preface_middle', 'preface_last'),
'postscripts' => array('postscript_first', 'postscript_middle', 'postscript_last')
);
foreach ($region_list as $sub_region_key => $sub_region_list) {
$active_regions = array();
foreach ($sub_region_list as $region_item) {
if ($vars[$region_item]) {
$active_regions[] = $region_item;
}
}
$vars[$sub_region_key] = $sub_region_key .'-'. strval(count($active_regions));
}
// Generate menu tree from source of primary links
$vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
// TNT THEME SETTINGS SECTION
// Hide breadcrumb on all pages
if (theme_get_setting('breadcrumb_display') == 0) {
$vars['breadcrumb'] = '';
}
// Set site title, slogan, mission, page title & separator (unless using Page Title module)
if (!module_exists('page_title')) {
$title = t(variable_get('site_name', ''));
$slogan = t(variable_get('site_slogan', ''));
$mission = t(variable_get('site_mission', ''));
$page_title = t(drupal_get_title());
$title_separator = theme_get_setting('configurable_separator');
if (drupal_is_front_page()) { // Front page title settings
switch (theme_get_setting('front_page_title_display')) {
case 'title_slogan':
$vars['head_title'] = drupal_set_title($title . $title_separator . $slogan);
break;
case 'slogan_title':
$vars['head_title'] = drupal_set_title($slogan . $title_separator . $title);
break;
case 'title_mission':
$vars['head_title'] = drupal_set_title($title . $title_separator . $mission);
break;
case 'custom':
if (theme_get_setting('page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('page_title_display_custom')));
}
}
}
else { // Non-front page title settings
switch (theme_get_setting('other_page_title_display')) {
case 'ptitle_slogan':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $slogan);
break;
case 'ptitle_stitle':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $title);
break;
case 'ptitle_smission':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $mission);
break;
case 'ptitle_custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title($page_title . $title_separator . t(theme_get_setting
('other_page_title_display_custom')));
}
break;
case 'custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('other_page_title_display_custom')));
}
}
}
$vars['head_title'] = strip_tags($vars['head_title']); // Remove any potential html tags
}
// Set meta keywords and description (unless using Meta tags module)
if (!module_exists('nodewords')) {
if (theme_get_setting('meta_keywords') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
if (theme_get_setting('meta_description') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
}
if (drupal_is_front_page()) {
$vars['closure'] .= 'Theme provided by Acquia, Inc. under
GPL license from TopNotchThemes Drupal themes';
}
}
function phptemplate_preprocess_block(&$vars) {
// Add regions with rounded blocks (e.g., sidebar_first, sidebar_last) to $rounded_regions array
$rounded_regions = array(sidebar_first);
$vars['rounded_block'] = (in_array($vars['block']->region, $rounded_regions)) ? TRUE : FALSE;
}
function phptemplate_preprocess_node(&$vars) {
// Build array of handy node classes
$node_classes = array();
$node_classes[] = $vars['zebra']; // Node is odd or even
$node_classes[] = (!$vars['node']->status) ? 'node-unpublished' : ''; // Node is unpublished
$node_classes[] = ($vars['sticky']) ? 'sticky' : ''; // Node is sticky
$node_classes[] = (isset($vars['node']->teaser)) ? 'teaser' : 'full-node'; // Node is teaser or full-node
$node_classes[] = 'node-type-'. $vars['node']->type; // Node is type-x, e.g., node-type-page
$node_classes = array_filter($node_classes); // Remove empty elements
$vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces
// Add node_bottom region content
$vars['node_bottom'] = theme('blocks', 'node_bottom');
// Node Theme Settings
// Date & author
$date = t('Posted ') . format_date($vars['node']->created, 'medium'); // Format date as small, medium,
or large
$author = theme('username', $vars['node']);
$author_only_separator = t('Posted by ');
$author_date_separator = t(' by ');
$submitted_by_content_type = (theme_get_setting('submitted_by_enable_content_type') == 1) ? $vars['node']->type :
'default';
$date_setting = (theme_get_setting('submitted_by_date_'. $submitted_by_content_type) == 1);
$author_setting = (theme_get_setting('submitted_by_author_'. $submitted_by_content_type) == 1);
$author_separator = ($date_setting) ? $author_date_separator : $author_only_separator;
$date_author = ($date_setting) ? $date : '';
$date_author .= ($author_setting) ? $author_separator . $author : '';
$vars['submitted'] = $date_author;
// Taxonomy
$taxonomy_content_type = (theme_get_setting('taxonomy_enable_content_type') == 1) ? $vars['node']->type : 'default';
$taxonomy_display = theme_get_setting('taxonomy_display_'. $taxonomy_content_type);
$taxonomy_format = theme_get_setting('taxonomy_format_'. $taxonomy_content_type);
if ((module_exists('taxonomy')) && ($taxonomy_display == 'all' || ($taxonomy_display == 'only' && $vars['page']))) {
$vocabularies = taxonomy_get_vocabularies($vars['node']->type);
$output = '';
$term_delimiter = ', ';
foreach ($vocabularies as $vocabulary) {
if (theme_get_setting('taxonomy_vocab_hide_'. $taxonomy_content_type .'_'. $vocabulary->vid) != 1) {
$terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid);
if ($terms) {
$term_items = '';
foreach ($terms as $term) { // Build vocabulary term items
$term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' =>
strip_tags($term->description))));
$term_items .= '
';
}
if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate
$output .= '
.':
';
$output .= substr_replace($term_items, '
', -(strlen($term_delimiter) + 5)) .'
';
}
else {
$output .= $term_items;
}
}
}
}
if ($output != '') {
$output = ($taxonomy_format == 'list') ? substr_replace($output, '
', -(strlen($term_delimiter) + 5)) :
$output;
$output = '
'. $output .'
';
}
$vars['terms'] = $output;
}
else {
$vars['terms'] = '';
}
// Node Links
if (isset($vars['node']->links['node_read_more'])) {
$node_content_type = (theme_get_setting('readmore_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['node_read_more'] = array(
'title' => _themesettings_link(
theme_get_setting('readmore_prefix_'. $node_content_type),
theme_get_setting('readmore_suffix_'. $node_content_type),
t(theme_get_setting('readmore_'. $node_content_type)),
'node/'. $vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('readmore_title_'. $node_content_type))),
'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'readmore-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_add'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
if ($vars['teaser']) {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_add_prefix_'. $node_content_type),
theme_get_setting('comment_add_suffix_'. $node_content_type),
t(theme_get_setting('comment_add_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_add_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-add-item'),
'html' => TRUE,
);
}
else {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_node_prefix_'. $node_content_type),
theme_get_setting('comment_node_suffix_'. $node_content_type),
t(theme_get_setting('comment_node_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_node_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-node-item'),
'html' => TRUE,
);
}
}
if (isset($vars['node']->links['comment_new_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_new_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_new_prefix_'. $node_content_type),
theme_get_setting('comment_new_suffix_'. $node_content_type),
format_plural(
comment_num_new($vars['node']->nid),
t(theme_get_setting('comment_new_singular_'. $node_content_type)),
t(theme_get_setting('comment_new_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_new_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'new', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-new-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_prefix_'. $node_content_type),
theme_get_setting('comment_suffix_'. $node_content_type),
format_plural(
comment_num_all($vars['node']->nid),
t(theme_get_setting('comment_singular_'. $node_content_type)),
t(theme_get_setting('comment_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comments', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-item'),
'html' => TRUE,
);
}
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
function phptemplate_preprocess_comment(&$vars) {
global $user;
// Build array of handy comment classes
$comment_classes = array();
static $comment_odd = TRUE; // Comment is
odd or even
$comment_classes[] = $comment_odd ? 'odd' : 'even';
$comment_odd = !$comment_odd;
$comment_classes[] = ($vars['comment']->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : ''; // Comment is
unpublished
$comment_classes[] = ($vars['comment']->new) ? 'comment-new' : ''; // Comment is
new
$comment_classes[] = ($vars['comment']->uid == 0) ? 'comment-by-anon' : ''; // Comment is
by anonymous user
$comment_classes[] = ($user->uid && $vars['comment']->uid == $user->uid) ? 'comment-mine' : ''; // Comment is
by current user
$node = node_load($vars['comment']->nid); // Comment is
by node author
$vars['author_comment'] = ($vars['comment']->uid == $node->uid) ? TRUE : FALSE;
$comment_classes[] = ($vars['author_comment']) ? 'comment-by-author' : '';
$comment_classes = array_filter($comment_classes); // Remove empty
elements
$vars['comment_classes'] = implode(' ', $comment_classes); // Create class
list separated by spaces
// Date & author
$submitted_by = t('by ') .''. theme('username', $vars['comment']) .'';
$submitted_by .= t(' - ') .''. format_date($vars['comment']->timestamp, 'small')
.''; // Format date as small, medium, or large
$vars['submitted'] = $submitted_by;
}
/**
* Set defaults for comments display
* (Requires comment-wrapper.tpl.php file in theme directory)
*/
function phptemplate_preprocess_comment_wrapper(&$vars) {
$vars['display_mode'] = COMMENT_MODE_FLAT_EXPANDED;
$vars['display_order'] = COMMENT_ORDER_OLDEST_FIRST;
$vars['comment_controls_state'] = COMMENT_CONTROLS_HIDDEN;
}
/**
* Adds a class for the style of view
* (e.g., node, teaser, list, table, etc.)
* (Requires views-view.tpl.php file in theme directory)
*/
function phptemplate_preprocess_views_view(&$vars) {
$vars['css_name'] = $vars['css_name'] .' view-style-'. views_css_safe(strtolower($vars['view']->type));
}
/**
* Modify search results based on theme settings
*/
function phptemplate_preprocess_search_result(&$variables) {
static $search_zebra = 'even';
$search_zebra = ($search_zebra == 'even') ? 'odd' : 'even';
$variables['search_zebra'] = $search_zebra;
$result = $variables['result'];
$variables['url'] = check_url($result['link']);
$variables['title'] = check_plain($result['title']);
// Check for existence. User search does not include snippets.
$variables['snippet'] = '';
if (isset($result['snippet']) && theme_get_setting('search_snippet')) {
$variables['snippet'] = $result['snippet'];
}
$info = array();
if (!empty($result['type']) && theme_get_setting('search_info_type')) {
$info['type'] = check_plain($result['type']);
}
if (!empty($result['user']) && theme_get_setting('search_info_user')) {
$info['user'] = $result['user'];
}
if (!empty($result['date']) && theme_get_setting('search_info_date')) {
$info['date'] = format_date($result['date'], 'small');
}
if (isset($result['extra']) && is_array($result['extra'])) {
// $info = array_merge($info, $result['extra']); Drupal bug? [extra] array not keyed with 'comment' & 'upload'
if (!empty($result['extra'][0]) && theme_get_setting('search_info_comment')) {
$info['comment'] = $result['extra'][0];
}
if (!empty($result['extra'][1]) && theme_get_setting('search_info_upload')) {
$info['upload'] = $result['extra'][1];
}
}
// Provide separated and grouped meta information.
$variables['info_split'] = $info;
$variables['info'] = implode(' - ', $info);
// Provide alternate search result template.
$variables['template_files'][] = 'search-result-'. $variables['type'];
}
/**
* Override username theming to display/hide 'not verified' text
*/
function phptemplate_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
// Display or hide 'not verified' text
if (theme_get_setting('user_notverified_display') == 1) {
$output .= ' ('. t('not verified') .')';
}
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}
/**
* Set default form file input size
*/
function phptemplate_file($element) {
$element['#size'] = 40;
return theme_file($element);
}
/**
* Creates a link with prefix and suffix text
*
* @param $prefix
* The text to prefix the link.
* @param $suffix
* The text to suffix the link.
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
* The Drupal path being linked to, such as "admin/content/node". Can be an external
* or internal URL.
* - If you provide the full URL, it will be considered an
* external URL.
* - If you provide only the path (e.g. "admin/content/node"), it is considered an
* internal link. In this case, it must be a system URL as the url() function
* will generate the alias.
* @param $options
* An associative array that contains the following other arrays and values
* @param $attributes
* An associative array of HTML attributes to apply to the anchor tag.
* @param $query
* A query string to append to the link.
* @param $fragment
* A fragment identifier (named anchor) to append to the link.
* @param $absolute
* Whether to force the output to be an absolute link (beginning with http:).
* Useful for links that will be displayed outside the site, such as in an RSS
* feed.
* @param $html
* Whether the title is HTML or not (plain text)
* @return
* an HTML string containing a link to the given path.
*/
function _themesettings_link($prefix, $suffix, $text, $path, $options) {
return $prefix . (($text) ? l($text, $path, $options) : '') . $suffix;
}
/**
* Function spanify firstword
*/
function wordlimit($string, $length = 50, $ellipsis = "...") {
$words = explode(' ', strip_tags($string));
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string;
}
// Override theme_button for expanding graphic buttons
function phptemplate_button($element) {
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
// Wrap non-hidden input elements with span tags for button graphics
if (stristr($element['#attributes']['style'], 'display: none;') ||
stristr($element['#attributes']['class'], 'fivestar-submit') ||
is_array($element['#upload_validators'])) {
return '\n";
}
else {
return '\n";
}
}
function acquia_slate_preprocess_views_slideshow_ddblock(&$vars) {
drupal_rebuild_theme_registry();
$settings = $vars['views_slideshow_ddblock_slider_settings'];
// for showing debug info
views_slideshow_ddblock_show_content_debug_info($vars);
if ($settings['output_type'] == 'view_fields') {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add slide image variable
$slider_items[$key1]['slide_image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'slider_item_image'
'slider_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_title,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result-
>node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = 'nid . '">' . t
('Read more') . '';
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['views_slideshow_ddblock_slider_items'] = $slider_items;
}
}
function acquia_slate_preprocess_views_slideshow_ddblock_pager_content(&$vars) {
$settings = $vars['views_slideshow_ddblock_pager_settings'];
// for showing debug info
views_slideshow_ddblock_show_pager_debug_info($vars);
if (($settings['output_type'] == 'view_fields') &&
($settings['pager'] == 'number-pager' ||
$settings['pager'] == 'custom-pager' ||
$settings['pager'] == 'scrollable-pager' )) {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add pager_item_image variable
$pager_items[$key1]['image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'pager_item_image'
'pager_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_data_field_pager_item_text_field_pager_item_text_value,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result-
>node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['views_slideshow_ddblock_pager_items'] = $pager_items;
}
}
#48
Hello,
First of all, thanks for all your help and the great job developing this module. I have been some time trying to make this module work without success, and apparently I don't have any of the mistakes above... which is to say that probably I am making a more basic mistake; I would appreciate any insight. After following as closely as I could all the instructions I am just seeing the node titles on the page specified to show the slides and a piece of php code. This is the website page: http://krs.kadchi.com/node/11.
And my template.php:
(Since I don't have any formal training as programmer, I don't quite understand the part about uncommenting)
<?php
// $Id: template.php,v 1.1.2.8 2009/05/13 11:26:06 jwolf Exp $
/**
* Initialize theme settings
*/
if (is_null(theme_get_setting('user_notverified_display')) || theme_get_setting('rebuild_registry')) {
// Auto-rebuild the theme registry during theme development.
if(theme_get_setting('rebuild_registry')) {
drupal_set_message(t('The theme registry has been rebuilt. Turn off this feature on production
websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
}
global $theme_key;
// Get node types
$node_types = node_get_types('names');
/**
* The default values for the theme variables. Make sure $defaults exactly
* matches the $defaults in the theme-settings.php file.
*/
$defaults = array(
'user_notverified_display' => 1,
'breadcrumb_display' => 0,
'search_snippet' => 1,
'search_info_type' => 1,
'search_info_user' => 1,
'search_info_date' => 1,
'search_info_comment' => 1,
'search_info_upload' => 1,
'front_page_title_display' => 'title_slogan',
'page_title_display_custom' => '',
'other_page_title_display' => 'ptitle_slogan',
'other_page_title_display_custom' => '',
'configurable_separator' => ' | ',
'meta_keywords' => '',
'meta_description' => '',
'taxonomy_display_default' => 'only',
'taxonomy_format_default' => 'vocab',
'taxonomy_enable_content_type' => 0,
'submitted_by_author_default' => 1,
'submitted_by_date_default' => 1,
'submitted_by_enable_content_type' => 0,
'readmore_default' => t('Read more'),
'readmore_title_default' => t('Read the rest of this posting.'),
'readmore_prefix_default' => '',
'readmore_suffix_default' => '',
'readmore_enable_content_type' => 0,
'comment_singular_default' => t('1 comment'),
'comment_plural_default' => t('@count comments'),
'comment_title_default' => t('Jump to the first comment of this posting.'),
'comment_prefix_default' => '',
'comment_suffix_default' => '',
'comment_new_singular_default' => t('1 new comment'),
'comment_new_plural_default' => t('@count new comments'),
'comment_new_title_default' => t('Jump to the first new comment of this posting.'),
'comment_new_prefix_default' => '',
'comment_new_suffix_default' => '',
'comment_add_default' => t('Add new comment'),
'comment_add_title_default' => t('Add a new comment to this page.'),
'comment_add_prefix_default' => '',
'comment_add_suffix_default' => '',
'comment_node_default' => t('Add new comment'),
'comment_node_title_default' => t('Share your thoughts and opinions related to this posting.'),
'comment_node_prefix_default' => '',
'comment_node_suffix_default' => '',
'comment_enable_content_type' => 0,
'rebuild_registry' => 0,
);
// Make the default content-type settings the same as the default theme settings,
// so we can tell if content-type-specific settings have been altered.
$defaults = array_merge($defaults, theme_get_settings());
// Set the default values for content-type-specific settings
foreach ($node_types as $type => $name) {
$defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
$defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
$defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
$defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
$defaults["readmore_{$type}"] = $defaults['readmore_default'];
$defaults["readmore_title_{$type}"] = $defaults['readmore_title_default'];
$defaults["readmore_prefix_{$type}"] = $defaults['readmore_prefix_default'];
$defaults["readmore_suffix_{$type}"] = $defaults['readmore_suffix_default'];
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
// Get default theme settings.
$settings = theme_get_settings($theme_key);
// If content type-specifc settings are not enabled, reset the values
if (!$settings['readmore_enable_content_type']) {
foreach ($node_types as $type => $name) {
$settings["readmore_{$type}"] = $settings['readmore_default'];
$settings["readmore_title_{$type}"] = $settings['readmore_title_default'];
$settings["readmore_prefix_{$type}"] = $settings['readmore_prefix_default'];
$settings["readmore_suffix_{$type}"] = $settings['readmore_suffix_default'];
}
}
if (!$settings['comment_enable_content_type']) {
foreach ($node_types as $type => $name) {
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
}
// Don't save the toggle_node_info_ variables
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_'. $type]);
}
}
// Save default theme settings
variable_set(
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
array_merge($defaults, $settings)
);
// Force refresh of Drupal internals
theme_get_setting('', TRUE);
}
/**
* Modify theme variables
*/
function phptemplate_preprocess(&$vars) {
global $user; // Get the current user
$vars['is_admin'] = in_array('admin', $user->roles); // Check for Admin, logged in
$vars['logged_in'] = ($user->uid > 0) ? TRUE : FALSE;
}
function phptemplate_preprocess_page(&$vars) {
// Remove sidebars if disabled
if (!$vars['show_blocks']) {
$vars['sidebar_first'] = '';
$vars['sidebar_last'] = '';
}
// Build array of helpful body classes
$body_classes = array();
$body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in'; // Page user is
logged in
$body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; // Page is
front page
if (isset($vars['node'])) {
$body_classes[] = ($vars['node']) ? 'full-node' : ''; // Page is
one full node
$body_classes[] = (($vars['node']->type == 'forum') || (arg(0) == 'forum')) ? 'forum' : ''; // Page is
Forum page
$body_classes[] = ($vars['node']->type) ? 'node-type-'. $vars['node']->type : ''; // Page has
node-type-x, e.g., node-type-page
}
else {
$body_classes[] = (arg(0) == 'forum') ? 'forum' : ''; // Page is
Forum page
}
$body_classes[] = (module_exists('panels_page') && (panels_page_get_current())) ? 'panels' : ''; // Page is
Panels page
$body_classes[] = 'layout-'. (($vars['sidebar_first']) ? 'first-main' : 'main') . (($vars['sidebar_last']) ? '-last' :
''); // Page sidebars are active
if ($vars['preface_first'] || $vars['preface_middle'] || $vars['preface_last']) { // Preface
regions are active
$preface_regions = 'preface';
$preface_regions .= ($vars['preface_first']) ? '-first' : '';
$preface_regions .= ($vars['preface_middle']) ? '-middle' : '';
$preface_regions .= ($vars['preface_last']) ? '-last' : '';
$body_classes[] = $preface_regions;
}
if ($vars['postscript_first'] || $vars['postscript_middle'] || $vars['postscript_last']) { // Postscript
regions are active
$postscript_regions = 'postscript';
$postscript_regions .= ($vars['postscript_first']) ? '-first' : '';
$postscript_regions .= ($vars['postscript_middle']) ? '-middle' : '';
$postscript_regions .= ($vars['postscript_last']) ? '-last' : '';
$body_classes[] = $postscript_regions;
}
$body_classes = array_filter($body_classes); // Remove empty
elements
$vars['body_classes'] = implode(' ', $body_classes); // Create class
list separated by spaces
// Add preface & postscript classes with number of active sub-regions
$region_list = array(
'prefaces' => array('preface_first', 'preface_middle', 'preface_last'),
'postscripts' => array('postscript_first', 'postscript_middle', 'postscript_last')
);
foreach ($region_list as $sub_region_key => $sub_region_list) {
$active_regions = array();
foreach ($sub_region_list as $region_item) {
if ($vars[$region_item]) {
$active_regions[] = $region_item;
}
}
$vars[$sub_region_key] = $sub_region_key .'-'. strval(count($active_regions));
}
// Generate menu tree from source of primary links
$vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
// TNT THEME SETTINGS SECTION
// Hide breadcrumb on all pages
if (theme_get_setting('breadcrumb_display') == 0) {
$vars['breadcrumb'] = '';
}
// Set site title, slogan, mission, page title & separator (unless using Page Title module)
if (!module_exists('page_title')) {
$title = t(variable_get('site_name', ''));
$slogan = t(variable_get('site_slogan', ''));
$mission = t(variable_get('site_mission', ''));
$page_title = t(drupal_get_title());
$title_separator = theme_get_setting('configurable_separator');
if (drupal_is_front_page()) { // Front page title settings
switch (theme_get_setting('front_page_title_display')) {
case 'title_slogan':
$vars['head_title'] = drupal_set_title($title . $title_separator . $slogan);
break;
case 'slogan_title':
$vars['head_title'] = drupal_set_title($slogan . $title_separator . $title);
break;
case 'title_mission':
$vars['head_title'] = drupal_set_title($title . $title_separator . $mission);
break;
case 'custom':
if (theme_get_setting('page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('page_title_display_custom')));
}
}
}
else { // Non-front page title settings
switch (theme_get_setting('other_page_title_display')) {
case 'ptitle_slogan':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $slogan);
break;
case 'ptitle_stitle':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $title);
break;
case 'ptitle_smission':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $mission);
break;
case 'ptitle_custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title($page_title . $title_separator . t(theme_get_setting
('other_page_title_display_custom')));
}
break;
case 'custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('other_page_title_display_custom')));
}
}
}
$vars['head_title'] = strip_tags($vars['head_title']); // Remove any potential html tags
}
// Set meta keywords and description (unless using Meta tags module)
if (!module_exists('nodewords')) {
if (theme_get_setting('meta_keywords') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
if (theme_get_setting('meta_description') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
}
if (drupal_is_front_page()) {
$vars['closure'] .= 'Theme provided by Acquia, Inc. under
GPL license from TopNotchThemes Drupal themes';
}
}
function phptemplate_preprocess_block(&$vars) {
// Add regions with rounded blocks (e.g., sidebar_first, sidebar_last) to $rounded_regions array
$rounded_regions = array(sidebar_first);
$vars['rounded_block'] = (in_array($vars['block']->region, $rounded_regions)) ? TRUE : FALSE;
}
function phptemplate_preprocess_node(&$vars) {
// Build array of handy node classes
$node_classes = array();
$node_classes[] = $vars['zebra']; // Node is odd or even
$node_classes[] = (!$vars['node']->status) ? 'node-unpublished' : ''; // Node is unpublished
$node_classes[] = ($vars['sticky']) ? 'sticky' : ''; // Node is sticky
$node_classes[] = (isset($vars['node']->teaser)) ? 'teaser' : 'full-node'; // Node is teaser or full-node
$node_classes[] = 'node-type-'. $vars['node']->type; // Node is type-x, e.g., node-type-page
$node_classes = array_filter($node_classes); // Remove empty elements
$vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces
// Add node_bottom region content
$vars['node_bottom'] = theme('blocks', 'node_bottom');
// Node Theme Settings
// Date & author
$date = t('Posted ') . format_date($vars['node']->created, 'medium'); // Format date as small, medium,
or large
$author = theme('username', $vars['node']);
$author_only_separator = t('Posted by ');
$author_date_separator = t(' by ');
$submitted_by_content_type = (theme_get_setting('submitted_by_enable_content_type') == 1) ? $vars['node']->type :
'default';
$date_setting = (theme_get_setting('submitted_by_date_'. $submitted_by_content_type) == 1);
$author_setting = (theme_get_setting('submitted_by_author_'. $submitted_by_content_type) == 1);
$author_separator = ($date_setting) ? $author_date_separator : $author_only_separator;
$date_author = ($date_setting) ? $date : '';
$date_author .= ($author_setting) ? $author_separator . $author : '';
$vars['submitted'] = $date_author;
// Taxonomy
$taxonomy_content_type = (theme_get_setting('taxonomy_enable_content_type') == 1) ? $vars['node']->type : 'default';
$taxonomy_display = theme_get_setting('taxonomy_display_'. $taxonomy_content_type);
$taxonomy_format = theme_get_setting('taxonomy_format_'. $taxonomy_content_type);
if ((module_exists('taxonomy')) && ($taxonomy_display == 'all' || ($taxonomy_display == 'only' && $vars['page']))) {
$vocabularies = taxonomy_get_vocabularies($vars['node']->type);
$output = '';
$term_delimiter = ', ';
foreach ($vocabularies as $vocabulary) {
if (theme_get_setting('taxonomy_vocab_hide_'. $taxonomy_content_type .'_'. $vocabulary->vid) != 1) {
$terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid);
if ($terms) {
$term_items = '';
foreach ($terms as $term) { // Build vocabulary term items
$term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' =>
strip_tags($term->description))));
$term_items .= '
';
}
if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate
$output .= '
.':
';
$output .= substr_replace($term_items, '
', -(strlen($term_delimiter) + 5)) .'
';
}
else {
$output .= $term_items;
}
}
}
}
if ($output != '') {
$output = ($taxonomy_format == 'list') ? substr_replace($output, '
', -(strlen($term_delimiter) + 5)) :
$output;
$output = '
'. $output .'
';
}
$vars['terms'] = $output;
}
else {
$vars['terms'] = '';
}
// Node Links
if (isset($vars['node']->links['node_read_more'])) {
$node_content_type = (theme_get_setting('readmore_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['node_read_more'] = array(
'title' => _themesettings_link(
theme_get_setting('readmore_prefix_'. $node_content_type),
theme_get_setting('readmore_suffix_'. $node_content_type),
t(theme_get_setting('readmore_'. $node_content_type)),
'node/'. $vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('readmore_title_'. $node_content_type))),
'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'readmore-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_add'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
if ($vars['teaser']) {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_add_prefix_'. $node_content_type),
theme_get_setting('comment_add_suffix_'. $node_content_type),
t(theme_get_setting('comment_add_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_add_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-add-item'),
'html' => TRUE,
);
}
else {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_node_prefix_'. $node_content_type),
theme_get_setting('comment_node_suffix_'. $node_content_type),
t(theme_get_setting('comment_node_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_node_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-node-item'),
'html' => TRUE,
);
}
}
if (isset($vars['node']->links['comment_new_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_new_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_new_prefix_'. $node_content_type),
theme_get_setting('comment_new_suffix_'. $node_content_type),
format_plural(
comment_num_new($vars['node']->nid),
t(theme_get_setting('comment_new_singular_'. $node_content_type)),
t(theme_get_setting('comment_new_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_new_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'new', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-new-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_prefix_'. $node_content_type),
theme_get_setting('comment_suffix_'. $node_content_type),
format_plural(
comment_num_all($vars['node']->nid),
t(theme_get_setting('comment_singular_'. $node_content_type)),
t(theme_get_setting('comment_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comments', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-item'),
'html' => TRUE,
);
}
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
function phptemplate_preprocess_comment(&$vars) {
global $user;
// Build array of handy comment classes
$comment_classes = array();
static $comment_odd = TRUE; // Comment is
odd or even
$comment_classes[] = $comment_odd ? 'odd' : 'even';
$comment_odd = !$comment_odd;
$comment_classes[] = ($vars['comment']->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : ''; // Comment is
unpublished
$comment_classes[] = ($vars['comment']->new) ? 'comment-new' : ''; // Comment is
new
$comment_classes[] = ($vars['comment']->uid == 0) ? 'comment-by-anon' : ''; // Comment is
by anonymous user
$comment_classes[] = ($user->uid && $vars['comment']->uid == $user->uid) ? 'comment-mine' : ''; // Comment is
by current user
$node = node_load($vars['comment']->nid); // Comment is
by node author
$vars['author_comment'] = ($vars['comment']->uid == $node->uid) ? TRUE : FALSE;
$comment_classes[] = ($vars['author_comment']) ? 'comment-by-author' : '';
$comment_classes = array_filter($comment_classes); // Remove empty
elements
$vars['comment_classes'] = implode(' ', $comment_classes); // Create class
list separated by spaces
// Date & author
$submitted_by = t('by ') .''. theme('username', $vars['comment']) .'';
$submitted_by .= t(' - ') .''. format_date($vars['comment']->timestamp, 'small')
.''; // Format date as small, medium, or large
$vars['submitted'] = $submitted_by;
}
/**
* Set defaults for comments display
* (Requires comment-wrapper.tpl.php file in theme directory)
*/
function phptemplate_preprocess_comment_wrapper(&$vars) {
$vars['display_mode'] = COMMENT_MODE_FLAT_EXPANDED;
$vars['display_order'] = COMMENT_ORDER_OLDEST_FIRST;
$vars['comment_controls_state'] = COMMENT_CONTROLS_HIDDEN;
}
/**
* Adds a class for the style of view
* (e.g., node, teaser, list, table, etc.)
* (Requires views-view.tpl.php file in theme directory)
*/
function phptemplate_preprocess_views_view(&$vars) {
$vars['css_name'] = $vars['css_name'] .' view-style-'. views_css_safe(strtolower($vars['view']->type));
}
/**
* Modify search results based on theme settings
*/
function phptemplate_preprocess_search_result(&$variables) {
static $search_zebra = 'even';
$search_zebra = ($search_zebra == 'even') ? 'odd' : 'even';
$variables['search_zebra'] = $search_zebra;
$result = $variables['result'];
$variables['url'] = check_url($result['link']);
$variables['title'] = check_plain($result['title']);
// Check for existence. User search does not include snippets.
$variables['snippet'] = '';
if (isset($result['snippet']) && theme_get_setting('search_snippet')) {
$variables['snippet'] = $result['snippet'];
}
$info = array();
if (!empty($result['type']) && theme_get_setting('search_info_type')) {
$info['type'] = check_plain($result['type']);
}
if (!empty($result['user']) && theme_get_setting('search_info_user')) {
$info['user'] = $result['user'];
}
if (!empty($result['date']) && theme_get_setting('search_info_date')) {
$info['date'] = format_date($result['date'], 'small');
}
if (isset($result['extra']) && is_array($result['extra'])) {
// $info = array_merge($info, $result['extra']); Drupal bug? [extra] array not keyed with 'comment' & 'upload'
if (!empty($result['extra'][0]) && theme_get_setting('search_info_comment')) {
$info['comment'] = $result['extra'][0];
}
if (!empty($result['extra'][1]) && theme_get_setting('search_info_upload')) {
$info['upload'] = $result['extra'][1];
}
}
// Provide separated and grouped meta information.
$variables['info_split'] = $info;
$variables['info'] = implode(' - ', $info);
// Provide alternate search result template.
$variables['template_files'][] = 'search-result-'. $variables['type'];
}
/**
* Override username theming to display/hide 'not verified' text
*/
function phptemplate_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
// Display or hide 'not verified' text
if (theme_get_setting('user_notverified_display') == 1) {
$output .= ' ('. t('not verified') .')';
}
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}
/**
* Set default form file input size
*/
function phptemplate_file($element) {
$element['#size'] = 40;
return theme_file($element);
}
/**
* Creates a link with prefix and suffix text
*
* @param $prefix
* The text to prefix the link.
* @param $suffix
* The text to suffix the link.
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
* The Drupal path being linked to, such as "admin/content/node". Can be an external
* or internal URL.
* - If you provide the full URL, it will be considered an
* external URL.
* - If you provide only the path (e.g. "admin/content/node"), it is considered an
* internal link. In this case, it must be a system URL as the url() function
* will generate the alias.
* @param $options
* An associative array that contains the following other arrays and values
* @param $attributes
* An associative array of HTML attributes to apply to the anchor tag.
* @param $query
* A query string to append to the link.
* @param $fragment
* A fragment identifier (named anchor) to append to the link.
* @param $absolute
* Whether to force the output to be an absolute link (beginning with http:).
* Useful for links that will be displayed outside the site, such as in an RSS
* feed.
* @param $html
* Whether the title is HTML or not (plain text)
* @return
* an HTML string containing a link to the given path.
*/
function _themesettings_link($prefix, $suffix, $text, $path, $options) {
return $prefix . (($text) ? l($text, $path, $options) : '') . $suffix;
}
/**
* Function spanify firstword
*/
function wordlimit($string, $length = 50, $ellipsis = "...") {
$words = explode(' ', strip_tags($string));
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string;
}
// Override theme_button for expanding graphic buttons
function phptemplate_button($element) {
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
// Wrap non-hidden input elements with span tags for button graphics
if (stristr($element['#attributes']['style'], 'display: none;') ||
stristr($element['#attributes']['class'], 'fivestar-submit') ||
is_array($element['#upload_validators'])) {
return '\n";
}
else {
return '\n";
}
}
function acquia_slate_preprocess_views_slideshow_ddblock(&$vars) {
drupal_rebuild_theme_registry();
$settings = $vars['views_slideshow_ddblock_slider_settings'];
// for showing debug info
views_slideshow_ddblock_show_content_debug_info($vars);
if ($settings['output_type'] == 'view_fields') {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add slide image variable
$slider_items[$key1]['slide_image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'slider_item_image'
'slider_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_title,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result-
>node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = 'nid . '">' . t
('Read more') . '';
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['views_slideshow_ddblock_slider_items'] = $slider_items;
}
}
function acquia_slate_preprocess_views_slideshow_ddblock_pager_content(&$vars) {
$settings = $vars['views_slideshow_ddblock_pager_settings'];
// for showing debug info
views_slideshow_ddblock_show_pager_debug_info($vars);
if (($settings['output_type'] == 'view_fields') &&
($settings['pager'] == 'number-pager' ||
$settings['pager'] == 'custom-pager' ||
$settings['pager'] == 'scrollable-pager' )) {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add pager_item_image variable
$pager_items[$key1]['image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'pager_item_image'
'pager_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_data_field_pager_item_text_field_pager_item_text_value,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result-
>node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['views_slideshow_ddblock_pager_items'] = $pager_items;
}
}
#49
#47, #48 what is your issue?
#50
Hello,
First of all, thanks for all your help and the great job developing this module. I have been some time trying to make this module work without success, and apparently I don't have any of the mistakes above... which is to say that probably I am making a more basic mistake; I would appreciate any insight. After following as closely as I could all the instructions I am just seeing the node titles on the page specified to show the slides and a piece of php code. This is the website page: http://krs.kadchi.com/node/11.
And my template.php:
(Since I don't have any formal training as programmer, I don't quite understand the part about uncommenting)
<?php
// $Id: template.php,v 1.1.2.8 2009/05/13 11:26:06 jwolf Exp $
/**
* Initialize theme settings
*/
if (is_null(theme_get_setting('user_notverified_display')) || theme_get_setting('rebuild_registry')) {
// Auto-rebuild the theme registry during theme development.
if(theme_get_setting('rebuild_registry')) {
drupal_set_message(t('The theme registry has been rebuilt. Turn off this feature on production
websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
}
global $theme_key;
// Get node types
$node_types = node_get_types('names');
/**
* The default values for the theme variables. Make sure $defaults exactly
* matches the $defaults in the theme-settings.php file.
*/
$defaults = array(
'user_notverified_display' => 1,
'breadcrumb_display' => 0,
'search_snippet' => 1,
'search_info_type' => 1,
'search_info_user' => 1,
'search_info_date' => 1,
'search_info_comment' => 1,
'search_info_upload' => 1,
'front_page_title_display' => 'title_slogan',
'page_title_display_custom' => '',
'other_page_title_display' => 'ptitle_slogan',
'other_page_title_display_custom' => '',
'configurable_separator' => ' | ',
'meta_keywords' => '',
'meta_description' => '',
'taxonomy_display_default' => 'only',
'taxonomy_format_default' => 'vocab',
'taxonomy_enable_content_type' => 0,
'submitted_by_author_default' => 1,
'submitted_by_date_default' => 1,
'submitted_by_enable_content_type' => 0,
'readmore_default' => t('Read more'),
'readmore_title_default' => t('Read the rest of this posting.'),
'readmore_prefix_default' => '',
'readmore_suffix_default' => '',
'readmore_enable_content_type' => 0,
'comment_singular_default' => t('1 comment'),
'comment_plural_default' => t('@count comments'),
'comment_title_default' => t('Jump to the first comment of this posting.'),
'comment_prefix_default' => '',
'comment_suffix_default' => '',
'comment_new_singular_default' => t('1 new comment'),
'comment_new_plural_default' => t('@count new comments'),
'comment_new_title_default' => t('Jump to the first new comment of this posting.'),
'comment_new_prefix_default' => '',
'comment_new_suffix_default' => '',
'comment_add_default' => t('Add new comment'),
'comment_add_title_default' => t('Add a new comment to this page.'),
'comment_add_prefix_default' => '',
'comment_add_suffix_default' => '',
'comment_node_default' => t('Add new comment'),
'comment_node_title_default' => t('Share your thoughts and opinions related to this posting.'),
'comment_node_prefix_default' => '',
'comment_node_suffix_default' => '',
'comment_enable_content_type' => 0,
'rebuild_registry' => 0,
);
// Make the default content-type settings the same as the default theme settings,
// so we can tell if content-type-specific settings have been altered.
$defaults = array_merge($defaults, theme_get_settings());
// Set the default values for content-type-specific settings
foreach ($node_types as $type => $name) {
$defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
$defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
$defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
$defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
$defaults["readmore_{$type}"] = $defaults['readmore_default'];
$defaults["readmore_title_{$type}"] = $defaults['readmore_title_default'];
$defaults["readmore_prefix_{$type}"] = $defaults['readmore_prefix_default'];
$defaults["readmore_suffix_{$type}"] = $defaults['readmore_suffix_default'];
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
// Get default theme settings.
$settings = theme_get_settings($theme_key);
// If content type-specifc settings are not enabled, reset the values
if (!$settings['readmore_enable_content_type']) {
foreach ($node_types as $type => $name) {
$settings["readmore_{$type}"] = $settings['readmore_default'];
$settings["readmore_title_{$type}"] = $settings['readmore_title_default'];
$settings["readmore_prefix_{$type}"] = $settings['readmore_prefix_default'];
$settings["readmore_suffix_{$type}"] = $settings['readmore_suffix_default'];
}
}
if (!$settings['comment_enable_content_type']) {
foreach ($node_types as $type => $name) {
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
}
// Don't save the toggle_node_info_ variables
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_'. $type]);
}
}
// Save default theme settings
variable_set(
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
array_merge($defaults, $settings)
);
// Force refresh of Drupal internals
theme_get_setting('', TRUE);
}
/**
* Modify theme variables
*/
function phptemplate_preprocess(&$vars) {
global $user; // Get the current user
$vars['is_admin'] = in_array('admin', $user->roles); // Check for Admin, logged in
$vars['logged_in'] = ($user->uid > 0) ? TRUE : FALSE;
}
function phptemplate_preprocess_page(&$vars) {
// Remove sidebars if disabled
if (!$vars['show_blocks']) {
$vars['sidebar_first'] = '';
$vars['sidebar_last'] = '';
}
// Build array of helpful body classes
$body_classes = array();
$body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in'; // Page user is
logged in
$body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; // Page is
front page
if (isset($vars['node'])) {
$body_classes[] = ($vars['node']) ? 'full-node' : ''; // Page is
one full node
$body_classes[] = (($vars['node']->type == 'forum') || (arg(0) == 'forum')) ? 'forum' : ''; // Page is
Forum page
$body_classes[] = ($vars['node']->type) ? 'node-type-'. $vars['node']->type : ''; // Page has
node-type-x, e.g., node-type-page
}
else {
$body_classes[] = (arg(0) == 'forum') ? 'forum' : ''; // Page is
Forum page
}
$body_classes[] = (module_exists('panels_page') && (panels_page_get_current())) ? 'panels' : ''; // Page is
Panels page
$body_classes[] = 'layout-'. (($vars['sidebar_first']) ? 'first-main' : 'main') . (($vars['sidebar_last']) ? '-last' :
''); // Page sidebars are active
if ($vars['preface_first'] || $vars['preface_middle'] || $vars['preface_last']) { // Preface
regions are active
$preface_regions = 'preface';
$preface_regions .= ($vars['preface_first']) ? '-first' : '';
$preface_regions .= ($vars['preface_middle']) ? '-middle' : '';
$preface_regions .= ($vars['preface_last']) ? '-last' : '';
$body_classes[] = $preface_regions;
}
if ($vars['postscript_first'] || $vars['postscript_middle'] || $vars['postscript_last']) { // Postscript
regions are active
$postscript_regions = 'postscript';
$postscript_regions .= ($vars['postscript_first']) ? '-first' : '';
$postscript_regions .= ($vars['postscript_middle']) ? '-middle' : '';
$postscript_regions .= ($vars['postscript_last']) ? '-last' : '';
$body_classes[] = $postscript_regions;
}
$body_classes = array_filter($body_classes); // Remove empty
elements
$vars['body_classes'] = implode(' ', $body_classes); // Create class
list separated by spaces
// Add preface & postscript classes with number of active sub-regions
$region_list = array(
'prefaces' => array('preface_first', 'preface_middle', 'preface_last'),
'postscripts' => array('postscript_first', 'postscript_middle', 'postscript_last')
);
foreach ($region_list as $sub_region_key => $sub_region_list) {
$active_regions = array();
foreach ($sub_region_list as $region_item) {
if ($vars[$region_item]) {
$active_regions[] = $region_item;
}
}
$vars[$sub_region_key] = $sub_region_key .'-'. strval(count($active_regions));
}
// Generate menu tree from source of primary links
$vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
// TNT THEME SETTINGS SECTION
// Hide breadcrumb on all pages
if (theme_get_setting('breadcrumb_display') == 0) {
$vars['breadcrumb'] = '';
}
// Set site title, slogan, mission, page title & separator (unless using Page Title module)
if (!module_exists('page_title')) {
$title = t(variable_get('site_name', ''));
$slogan = t(variable_get('site_slogan', ''));
$mission = t(variable_get('site_mission', ''));
$page_title = t(drupal_get_title());
$title_separator = theme_get_setting('configurable_separator');
if (drupal_is_front_page()) { // Front page title settings
switch (theme_get_setting('front_page_title_display')) {
case 'title_slogan':
$vars['head_title'] = drupal_set_title($title . $title_separator . $slogan);
break;
case 'slogan_title':
$vars['head_title'] = drupal_set_title($slogan . $title_separator . $title);
break;
case 'title_mission':
$vars['head_title'] = drupal_set_title($title . $title_separator . $mission);
break;
case 'custom':
if (theme_get_setting('page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('page_title_display_custom')));
}
}
}
else { // Non-front page title settings
switch (theme_get_setting('other_page_title_display')) {
case 'ptitle_slogan':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $slogan);
break;
case 'ptitle_stitle':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $title);
break;
case 'ptitle_smission':
$vars['head_title'] = drupal_set_title($page_title . $title_separator . $mission);
break;
case 'ptitle_custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title($page_title . $title_separator . t(theme_get_setting
('other_page_title_display_custom')));
}
break;
case 'custom':
if (theme_get_setting('other_page_title_display_custom') !== '') {
$vars['head_title'] = drupal_set_title(t(theme_get_setting('other_page_title_display_custom')));
}
}
}
$vars['head_title'] = strip_tags($vars['head_title']); // Remove any potential html tags
}
// Set meta keywords and description (unless using Meta tags module)
if (!module_exists('nodewords')) {
if (theme_get_setting('meta_keywords') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
if (theme_get_setting('meta_description') !== '') {
$keywords = '';
$vars['head'] .= $keywords ."\n";
}
}
if (drupal_is_front_page()) {
$vars['closure'] .= 'Theme provided by Acquia, Inc. under
GPL license from TopNotchThemes Drupal themes';
}
}
function phptemplate_preprocess_block(&$vars) {
// Add regions with rounded blocks (e.g., sidebar_first, sidebar_last) to $rounded_regions array
$rounded_regions = array(sidebar_first);
$vars['rounded_block'] = (in_array($vars['block']->region, $rounded_regions)) ? TRUE : FALSE;
}
function phptemplate_preprocess_node(&$vars) {
// Build array of handy node classes
$node_classes = array();
$node_classes[] = $vars['zebra']; // Node is odd or even
$node_classes[] = (!$vars['node']->status) ? 'node-unpublished' : ''; // Node is unpublished
$node_classes[] = ($vars['sticky']) ? 'sticky' : ''; // Node is sticky
$node_classes[] = (isset($vars['node']->teaser)) ? 'teaser' : 'full-node'; // Node is teaser or full-node
$node_classes[] = 'node-type-'. $vars['node']->type; // Node is type-x, e.g., node-type-page
$node_classes = array_filter($node_classes); // Remove empty elements
$vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces
// Add node_bottom region content
$vars['node_bottom'] = theme('blocks', 'node_bottom');
// Node Theme Settings
// Date & author
$date = t('Posted ') . format_date($vars['node']->created, 'medium'); // Format date as small, medium,
or large
$author = theme('username', $vars['node']);
$author_only_separator = t('Posted by ');
$author_date_separator = t(' by ');
$submitted_by_content_type = (theme_get_setting('submitted_by_enable_content_type') == 1) ? $vars['node']->type :
'default';
$date_setting = (theme_get_setting('submitted_by_date_'. $submitted_by_content_type) == 1);
$author_setting = (theme_get_setting('submitted_by_author_'. $submitted_by_content_type) == 1);
$author_separator = ($date_setting) ? $author_date_separator : $author_only_separator;
$date_author = ($date_setting) ? $date : '';
$date_author .= ($author_setting) ? $author_separator . $author : '';
$vars['submitted'] = $date_author;
// Taxonomy
$taxonomy_content_type = (theme_get_setting('taxonomy_enable_content_type') == 1) ? $vars['node']->type : 'default';
$taxonomy_display = theme_get_setting('taxonomy_display_'. $taxonomy_content_type);
$taxonomy_format = theme_get_setting('taxonomy_format_'. $taxonomy_content_type);
if ((module_exists('taxonomy')) && ($taxonomy_display == 'all' || ($taxonomy_display == 'only' && $vars['page']))) {
$vocabularies = taxonomy_get_vocabularies($vars['node']->type);
$output = '';
$term_delimiter = ', ';
foreach ($vocabularies as $vocabulary) {
if (theme_get_setting('taxonomy_vocab_hide_'. $taxonomy_content_type .'_'. $vocabulary->vid) != 1) {
$terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid);
if ($terms) {
$term_items = '';
foreach ($terms as $term) { // Build vocabulary term items
$term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' =>
strip_tags($term->description))));
$term_items .= '
';
}
if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate
$output .= '
.':
';
$output .= substr_replace($term_items, '
', -(strlen($term_delimiter) + 5)) .'
';
}
else {
$output .= $term_items;
}
}
}
}
if ($output != '') {
$output = ($taxonomy_format == 'list') ? substr_replace($output, '
', -(strlen($term_delimiter) + 5)) :
$output;
$output = '
'. $output .'
';
}
$vars['terms'] = $output;
}
else {
$vars['terms'] = '';
}
// Node Links
if (isset($vars['node']->links['node_read_more'])) {
$node_content_type = (theme_get_setting('readmore_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['node_read_more'] = array(
'title' => _themesettings_link(
theme_get_setting('readmore_prefix_'. $node_content_type),
theme_get_setting('readmore_suffix_'. $node_content_type),
t(theme_get_setting('readmore_'. $node_content_type)),
'node/'. $vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('readmore_title_'. $node_content_type))),
'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'readmore-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_add'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
if ($vars['teaser']) {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_add_prefix_'. $node_content_type),
theme_get_setting('comment_add_suffix_'. $node_content_type),
t(theme_get_setting('comment_add_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_add_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-add-item'),
'html' => TRUE,
);
}
else {
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_node_prefix_'. $node_content_type),
theme_get_setting('comment_node_suffix_'. $node_content_type),
t(theme_get_setting('comment_node_'. $node_content_type)),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_node_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-node-item'),
'html' => TRUE,
);
}
}
if (isset($vars['node']->links['comment_new_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_new_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_new_prefix_'. $node_content_type),
theme_get_setting('comment_new_suffix_'. $node_content_type),
format_plural(
comment_num_new($vars['node']->nid),
t(theme_get_setting('comment_new_singular_'. $node_content_type)),
t(theme_get_setting('comment_new_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_new_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'new', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-new-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_prefix_'. $node_content_type),
theme_get_setting('comment_suffix_'. $node_content_type),
format_plural(
comment_num_all($vars['node']->nid),
t(theme_get_setting('comment_singular_'. $node_content_type)),
t(theme_get_setting('comment_plural_'. $node_content_type))
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => t(theme_get_setting('comment_title_'. $node_content_type))),
'query' => NULL, 'fragment' => 'comments', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-item'),
'html' => TRUE,
);
}
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
function phptemplate_preprocess_comment(&$vars) {
global $user;
// Build array of handy comment classes
$comment_classes = array();
static $comment_odd = TRUE; // Comment is
odd or even
$comment_classes[] = $comment_odd ? 'odd' : 'even';
$comment_odd = !$comment_odd;
$comment_classes[] = ($vars['comment']->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : ''; // Comment is
unpublished
$comment_classes[] = ($vars['comment']->new) ? 'comment-new' : ''; // Comment is
new
$comment_classes[] = ($vars['comment']->uid == 0) ? 'comment-by-anon' : ''; // Comment is
by anonymous user
$comment_classes[] = ($user->uid && $vars['comment']->uid == $user->uid) ? 'comment-mine' : ''; // Comment is
by current user
$node = node_load($vars['comment']->nid); // Comment is
by node author
$vars['author_comment'] = ($vars['comment']->uid == $node->uid) ? TRUE : FALSE;
$comment_classes[] = ($vars['author_comment']) ? 'comment-by-author' : '';
$comment_classes = array_filter($comment_classes); // Remove empty
elements
$vars['comment_classes'] = implode(' ', $comment_classes); // Create class
list separated by spaces
// Date & author
$submitted_by = t('by ') .''. theme('username', $vars['comment']) .'';
$submitted_by .= t(' - ') .''. format_date($vars['comment']->timestamp, 'small')
.''; // Format date as small, medium, or large
$vars['submitted'] = $submitted_by;
}
/**
* Set defaults for comments display
* (Requires comment-wrapper.tpl.php file in theme directory)
*/
function phptemplate_preprocess_comment_wrapper(&$vars) {
$vars['display_mode'] = COMMENT_MODE_FLAT_EXPANDED;
$vars['display_order'] = COMMENT_ORDER_OLDEST_FIRST;
$vars['comment_controls_state'] = COMMENT_CONTROLS_HIDDEN;
}
/**
* Adds a class for the style of view
* (e.g., node, teaser, list, table, etc.)
* (Requires views-view.tpl.php file in theme directory)
*/
function phptemplate_preprocess_views_view(&$vars) {
$vars['css_name'] = $vars['css_name'] .' view-style-'. views_css_safe(strtolower($vars['view']->type));
}
/**
* Modify search results based on theme settings
*/
function phptemplate_preprocess_search_result(&$variables) {
static $search_zebra = 'even';
$search_zebra = ($search_zebra == 'even') ? 'odd' : 'even';
$variables['search_zebra'] = $search_zebra;
$result = $variables['result'];
$variables['url'] = check_url($result['link']);
$variables['title'] = check_plain($result['title']);
// Check for existence. User search does not include snippets.
$variables['snippet'] = '';
if (isset($result['snippet']) && theme_get_setting('search_snippet')) {
$variables['snippet'] = $result['snippet'];
}
$info = array();
if (!empty($result['type']) && theme_get_setting('search_info_type')) {
$info['type'] = check_plain($result['type']);
}
if (!empty($result['user']) && theme_get_setting('search_info_user')) {
$info['user'] = $result['user'];
}
if (!empty($result['date']) && theme_get_setting('search_info_date')) {
$info['date'] = format_date($result['date'], 'small');
}
if (isset($result['extra']) && is_array($result['extra'])) {
// $info = array_merge($info, $result['extra']); Drupal bug? [extra] array not keyed with 'comment' & 'upload'
if (!empty($result['extra'][0]) && theme_get_setting('search_info_comment')) {
$info['comment'] = $result['extra'][0];
}
if (!empty($result['extra'][1]) && theme_get_setting('search_info_upload')) {
$info['upload'] = $result['extra'][1];
}
}
// Provide separated and grouped meta information.
$variables['info_split'] = $info;
$variables['info'] = implode(' - ', $info);
// Provide alternate search result template.
$variables['template_files'][] = 'search-result-'. $variables['type'];
}
/**
* Override username theming to display/hide 'not verified' text
*/
function phptemplate_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
// Display or hide 'not verified' text
if (theme_get_setting('user_notverified_display') == 1) {
$output .= ' ('. t('not verified') .')';
}
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}
/**
* Set default form file input size
*/
function phptemplate_file($element) {
$element['#size'] = 40;
return theme_file($element);
}
/**
* Creates a link with prefix and suffix text
*
* @param $prefix
* The text to prefix the link.
* @param $suffix
* The text to suffix the link.
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
* The Drupal path being linked to, such as "admin/content/node". Can be an external
* or internal URL.
* - If you provide the full URL, it will be considered an
* external URL.
* - If you provide only the path (e.g. "admin/content/node"), it is considered an
* internal link. In this case, it must be a system URL as the url() function
* will generate the alias.
* @param $options
* An associative array that contains the following other arrays and values
* @param $attributes
* An associative array of HTML attributes to apply to the anchor tag.
* @param $query
* A query string to append to the link.
* @param $fragment
* A fragment identifier (named anchor) to append to the link.
* @param $absolute
* Whether to force the output to be an absolute link (beginning with http:).
* Useful for links that will be displayed outside the site, such as in an RSS
* feed.
* @param $html
* Whether the title is HTML or not (plain text)
* @return
* an HTML string containing a link to the given path.
*/
function _themesettings_link($prefix, $suffix, $text, $path, $options) {
return $prefix . (($text) ? l($text, $path, $options) : '') . $suffix;
}
/**
* Function spanify firstword
*/
function wordlimit($string, $length = 50, $ellipsis = "...") {
$words = explode(' ', strip_tags($string));
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string;
}
// Override theme_button for expanding graphic buttons
function phptemplate_button($element) {
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
// Wrap non-hidden input elements with span tags for button graphics
if (stristr($element['#attributes']['style'], 'display: none;') ||
stristr($element['#attributes']['class'], 'fivestar-submit') ||
is_array($element['#upload_validators'])) {
return '\n";
}
else {
return '\n";
}
}
function acquia_slate_preprocess_views_slideshow_ddblock(&$vars) {
drupal_rebuild_theme_registry();
$settings = $vars['views_slideshow_ddblock_slider_settings'];
// for showing debug info
views_slideshow_ddblock_show_content_debug_info($vars);
if ($settings['output_type'] == 'view_fields') {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add slide image variable
$slider_items[$key1]['slide_image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'slider_item_image'
'slider_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_title,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result-
>node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = 'nid . '">' . t
('Read more') . '';
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['views_slideshow_ddblock_slider_items'] = $slider_items;
}
}
function acquia_slate_preprocess_views_slideshow_ddblock_pager_content(&$vars) {
$settings = $vars['views_slideshow_ddblock_pager_settings'];
// for showing debug info
views_slideshow_ddblock_show_pager_debug_info($vars);
if (($settings['output_type'] == 'view_fields') &&
($settings['pager'] == 'number-pager' ||
$settings['pager'] == 'custom-pager' ||
$settings['pager'] == 'scrollable-pager' )) {
if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
if (!empty($vars['views_slideshow_ddblock_content'])) {
foreach ($vars['views_slideshow_ddblock_content'] as $key1 => $result) {
// add pager_item_image variable
$pager_items[$key1]['image'] = views_slideshow_ddblock_add_image(
$vars,
// determines which imagcache preset to use, leave to 'pager_item_image'
'pager_item_image',
// name of CCK generated image field, change if needed.
$result->node_data_field_pager_item_text_field_image_fid,
// alt attribute of image or NULL
$result->node_data_field_pager_item_text_field_pager_item_text_value,
// cck content type for default image or NULL, change if needed
NULL, //'ddblock_news_item',
// cck fieldname for default image or NULL, change if needed
NULL, //'field_image',
// to link the image to or NULL, change if needed
NULL // base_path() . 'node/' . $result->nid
);
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result-
>node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['views_slideshow_ddblock_pager_items'] = $pager_items;
}
}
#51
Set issue to closed, @david_p, please don't open it again when you don't give more information.
#52
Hello,
First of all, thanks for all your help and the great job developing this module. I have been some time trying to make this module work without success, and apparently I don't have any of the mistakes above... which is to say that probably I am making a more basic mistake; I would appreciate any insight. After following as closely as I could all the instructions I am just seeing the node titles on the page specified to show the slides and a piece of php code. This is the website page: http://krs.kadchi.com/node/11.
*P.S: This is embarrassing. I wasn't even able to post properly.
#53
I had a look at your site and the preprocess functions.
They are for the views_slideshow_ddblock module.
Can you post the issue in the issue queue of the views_slideshow_ddblock module?
Will set this issue to closed.
#54
Hi there... I'm having this same problem and have checked all of the solutions used above and none are working.
My theme name is inserted into template.php with correct capitalization. My image field comes up in the debug information as node_data_field_pager_item_text_field_image_fid, which matches the one in template.php (node_data_field_pager_item_text_field_image_fid). My view name is "news_items" and is correctly capitalized in the template.php. All are below... please help...
Debug:
*
'news_items'
*
stdClass::__set_state(array(
'nid' => '41',
'node_title' => 'test 3',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'test 3',
'node_type' => 'ddblock_news_item',
'node_vid' => '41',
'node_data_field_pager_item_text_field_slide_text_value' => '
test 3
',
'node_data_field_pager_item_text_field_image_fid' => '38',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => '
test 3
',
'node_revisions_format' => '1',
'node_created' => '1271181717',
))
Views SQL:
SELECT node.nid AS nid,node.title AS node_title,
node_data_field_pager_item_text.field_pager_item_text_value AS node_data_field_pager_item_text_field_pager_item_text_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_pager_item_text.field_slide_text_value AS node_data_field_pager_item_text_field_slide_text_value,
node_data_field_pager_item_text.field_image_fid AS node_data_field_pager_item_text_field_image_fid,
node_data_field_pager_item_text.field_image_list AS node_data_field_pager_item_text_field_image_list,
node_data_field_pager_item_text.field_image_data AS node_data_field_pager_item_text_field_image_data,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format,
node.created AS node_created
FROM node node
LEFT JOIN content_type_ddblock_news_item node_data_field_pager_item_text ON node.vid = node_data_field_pager_item_text.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.status <> 0) AND (node.type in ('ddblock_news_item'))
ORDER BY node_created ASC
#55
#54
Your preprocess functions and your debug lines look ok.
Do you have javascript errors on your page?
Do you have a wysiwyg editor installed?
Do you have a link to the slideshow on your Drupal site?
#56
#55
Thanks so much for your help ppblaauw. After reading all these threads I'm really impressed with your dedication to making this module great.
I don't have any java errors. I do have FCKeditor installed. Should I try excluding it from being an editor for any of the slideshow fields?
Here's where the slideshow appears (only the front page). The debug text is still displaying: http://www.letsgowild.ca/
---
Edit:
I deleted the existing News item content I had created and then configured the "slide text" and "body" fields so they didn't use FCKeditor anymore. I created two new news item nodes, but sadly still no images in the slideshow.
#57
#56
I had a look at your Drupal site and actually see a javascript error.
$(document).everyTime is not a function
[Break on this error] }, 0);
in clock.js (line 375)
Could you disable the block with the clock for the moment?
#58
#57
I disabled the clock and it works!
You are a genius. I would have never looked for that. Thank you so much.
#59
#60
Automatically closed -- issue fixed for 2 weeks with no activity.
#61
Facing same problem images not showing...
* Created two node...display in views preview but not in ddblock...
attached my template.php file...
please help me how can i short out
#62
#61 Please have a look at the faq question: Images not showing, only grey box.
If you can not solve it yourself, attach the result of the drupal_set_message lines, so I can help you better.
Hope this helps you further, please let me know.
Tip: when you post issues in an issue with status closed, they will not show up in my screen. Just by coincidence I found this new post in a closed issue. You need to set the issue to active again, so It shows up in the issue queue by default (all open issues).
#63
Hello ppblaauw... I have searched all through the site and I have not been able to fix my problem.
I followed the instructions according to the Advanced DD block slideshow tutorial. I have copied the pre-process into my template.php file. I have created 2 nodes of news-item. I am using panels to display the ddblock. I am using the latest versions of ddblock module, all submodules, and drupal 6.19.
Once I complete the ddblock configuration, all I can see is the ddblock title... ddblock-news-items-slideshow. No images, no text, no pager.
My template.php file reads:
*****************************
<?php
/**
* Embed a Related Posts Region in a node.tpl.php file. This places a region after the node content and above the comments.
* drupal.org/node/208869
*/
function phptemplate_preprocess_node(&$variables, $hook) {
$variables['related'] = theme('blocks', 'related');
}
/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.6 (01-OCT-2009)
* Licenced under GPL license
* http://www.gnu.org/licenses/gpl.html
*/
/**
* Override or insert variables into the ddblock_cycle_block_content templates.
* Used to convert variables from view_fields to slider_items template variables
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function default_preprocess_ddblock_cycle_block_content(&$vars) {
if ($vars['output_type'] == 'view_fields') {
$content = array();
// Add slider_items for the template
// If you use the devel module uncomment the following line to see the theme variables
// dsm($vars['settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following line to see the theme variables
drupal_set_message('' . var_export($vars['settings']['view_name'], true) . '');
drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
node_title) .
node_data_field_pager_item_text_field_pager_item_text_value) .
// get image id
$fid = $result->node_data_field_pager_item_text_field_image_fid;
// get path to image
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> ''){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'
'"/>';
}
}
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['slider_items'] = $slider_items;
}
}
/**
* Override or insert variables into the ddblock_cycle_pager_content templates.
* Used to convert variables from view_fields to pager_items template variables
* Only used for custom pager items
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function default_preprocess_ddblock_cycle_pager_content(&$vars) {
if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
$content = array();
// Add pager_items for the template
// If you use the devel module uncomment the following lines to see the theme variables
// dsm($vars['pager_settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following lines to see the theme variables
drupal_set_message('' . var_export($vars['pager_settings'], true) . '');
drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['pager_settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_field_image_fid;
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') &&
is_array(imagecache_presets()) &&
$vars['imgcache_pager_item'] <> ''){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'
'"/>';
}
}
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}
*****************************************
Once I comment out the drupal_set_message... for both the block_content and pager_content, the results are:
****************************************
*
array (
'delta' => '6',
'output_type' => 'view_fields',
'pager' => 'custom-pager',
'pager_container' => NULL,
'pager_event' => NULL,
'pager_height' => 63,
'pager_width' => 195,
'imgcache_pager_item' => '',
'pager_position' => 'bottom',
'template' => 'custom',
'custom_template' => 'gradient-blue30p',
'view_name' => 'news_items',
)
*
stdClass::__set_state(array(
'nid' => '401',
'node_title' => 'news item 2',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'news item pager 2',
'node_type' => 'ddblock_news_item',
'node_vid' => '401',
'node_data_field_pager_item_text_field_slide_text_value' => 'this is the slide text for item 2',
'node_data_field_pager_item_text_field_image_fid' => '822',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'The Views Slideshow: Dynamic Display Block module is a views_slideshow plugin mainly ... site. Support Support for the views slideshow: dynamic display block module is given ... dynamic display block, views slideshow dynamic display block, views slideshow dynamic display block',
'node_revisions_format' => '1',
'node_created' => '1287651421',
))
*
'news_items'
*
stdClass::__set_state(array(
'nid' => '401',
'node_title' => 'news item 2',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'news item pager 2',
'node_type' => 'ddblock_news_item',
'node_vid' => '401',
'node_data_field_pager_item_text_field_slide_text_value' => 'this is the slide text for item 2',
'node_data_field_pager_item_text_field_image_fid' => '822',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'The Views Slideshow: Dynamic Display Block module is a views_slideshow plugin mainly ... site. Support Support for the views slideshow: dynamic display block module is given ... dynamic display block, views slideshow dynamic display block, views slideshow dynamic display block',
'node_revisions_format' => '1',
'node_created' => '1287651421',
))
*******************************
I don't know what else to do from here. Do you mind having a look and pointing me in the right direction? Thanks for your kind assistance!
#64
i figured out the answer to my own problem... i did not have gradient-blue30p installed properly in my themes folder... after i installed it correctly, the DD block shows up!
#65
Set status to fixed
#66
Hi,
Been struggling for a while now to configure the module.
The images are not being displayed (the pager is ok),
checked the paths from the debug info, but i seem to be overlooking something.
* array (
'delta' => '18',
'output_type' => 'view_fields',
'pager' => 'custom-pager',
'pager_container' => NULL,
'pager_event' => NULL,
'pager_height' => 63,
'pager_width' => 195,
'pager_position' => 'top',
'template' => 'upright40',
'custom_template' => NULL,
'view_name' => 'news_items',
)
*
stdClass::__set_state(array(
'nid' => '9',
'node_title' => '1',
'node_data_field_pager_item_text_field_pager_item_text_value' => '1',
'node_type' => 'ddblock_news_item',
'node_vid' => '9',
'node_data_field_pager_item_text_field_slide_text_value' => '1',
'node_data_field_pager_item_text_field_image_fid' => '9',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => '',
'node_revisions_format' => '1',
'node_created' => '1286809586',
))
*
'news_items'
*
stdClass::__set_state(array(
'nid' => '9',
'node_title' => '1',
'node_data_field_pager_item_text_field_pager_item_text_value' => '1',
'node_type' => 'ddblock_news_item',
'node_vid' => '9',
'node_data_field_pager_item_text_field_slide_text_value' => '1',
'node_data_field_pager_item_text_field_image_fid' => '9',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => '',
'node_revisions_format' => '1',
'node_created' => '1286809586',
))
Any hints/tips would be greatly appreciated.
Thx,
Seppe
#67
I've checked following page http://ddblock.myalbums.biz/faq#19n805
and use one of the upright themes (copied to custom/modules/ddblock)
#68
Im using an imagecache preset in the view.
Are there any patches needed?
Thx, Seppe
#69
Pls find attached a printscreen of the result so far (my apologies for the abundance of posts)
The html source contains following as image path:
../sites/default/files/imagecache//Lighthouse.jpg
Seems like the preset name is not part of the file path, would be solved if:
../sites/default/files/imagecache/slideshowitem/Lighthouse.jpg
Solved it for now by hardcoding the preset name in template.php
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '')
{
$slider_items[$key1]['slide_image'] = theme('imagecache',
'slideshowitem',
$filepath,
check_plain($result->node_title));
drupal_set_message('' . $vars['imgcache_slide'] . '');
}
Thx for the excellent module :-)
#70
Seppe,
You can select the image-cache preset in the configuration page of the slideshow.
Do you have a link to your Internet site?
Hope this helps you further, please let me know.
#71
Automatically closed -- issue fixed for 2 weeks with no activity.
#72
#15 fixed it for me.
The docs recommended the reverse, but I suppose it's one or the other.
node_data_field_image_field_image_fid
or
node_data_field_pager_item_text_field_image_fid
Thanks for a cool module!
#73
I get the slider text, the read more button, and the pager item text, but I don't get any image. Plz help to display the image.
I attached my template.php file.
#74
Please attach template.php file, the result of the debug lines and a link to the Internet site.
#75
Hi ppblaauw
I hope you are great. I am having what I believe is the same problem, My site is showing well in newer versions of internet explorer and Firefox. However it is not showing images in the ddblock in ie 7. I am just getting the grey box. I have attached the template.php, and debug lines. The link to the site is http://byndelle.com
Regards,
Adrian
#76
#75, Sorry, I can't give support anymore for commercial themes from other theme builders.
You can try the theme builder where you purchased the theme.
http://www.themeshark.com/drupal-themes/great-white-drupal-theme
#77
I don't see images, but have the error message:
warning: Invalid argument supplied for foreach() in /home/content/s/i/l/silveroffshroe/html/sites/all/themes/zeropoint/custom/modules/ddblock/ddblock-cycle-block-content-upright30.tpl.php on line 47.
I have attached my template file.
Filip
#78
Hi,
My ddblock firtstly works but now picture area is grey. i did this module many times and also now it is working my other site (bitkia).
Could you help me please, i attach my template.php file
Here is the ddblock page of my site