I have a working dynamic display block on my draft homepage. I am hoping to add seperate links to the "Read more..." button. I followed the instructions to add Url view and input field for the nodes associate with the slideshow. After I add in the new preprocess code to include that variable, the "Read more..." button disappears from the slideshow altogether. As requested, here's my template.php file. I am using a custom theme built out of the Zen starterkit.

Any help you can provide would be much appreciated.

Best,

Chris

Comments

ppblaauw’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

When you uncomment the drupal_set_message line in the content preprocess function you can see the fields CCK generates for you CCK fields

The preprocess function is looking for:

node_data_field_pager_item_text_field_url_value

Have a look in the result of the drupal_set_message debug line if this is the fieldname generated in your case. If this is not the fieldname you need to change it in the preprocess function.

Hope this helps you further, please let me know.

If you can not find out what the fieldname should be please also attach the result of the drupal_set_message lines. A link to the Internet site would also be helpful

cvaughn13’s picture

I have uncommented out the drupal_set_message debug lines; however I am not exactly sure where I should be seeing the debug info. When I return back to the ddblock (which is on my homepage) it runs as normal but without the "Read more..." image. Where should I go to see the debug messages?

Unfortunately, I am on a development server and it is not online - so I can't give you a link.

Thanks for your help.

ppblaauw’s picture

After you uncommented the drupal_set_meessage debug line in the preprocess functions you should reload the page with the ddblock slideshow.
At this page you should see the result of the debug lines.

cvaughn13’s picture

After I uncomment out the drupal set message lines, none of the debug messages appears on the page with the ddblock slideshow. Is there another way to see the debug lines? I've saved and reloaded the page with no success.

Thanks,

ppblaauw’s picture

You can also know the fieldname created by CCK by the following:

A field name generated by CCK will be build up out of three parts

1.) node_data_
2.) field name first field in content type: field_[name of first field]_
3.) field name like: field_[name of field]_value

If your field name for the link to other pages is: url

the generated field_name will be: node_data_field_pager_item_text_field_url_value

You need to replace url with the field-name you use for the link to other pages.

like

          // add slide_read_more variable and slide_node variable
          if (isset($result->node_data_field_pager_item_text_field_[replace]_value)) {
            $slider_items[$key1]['slide_read_more'] =  l('Read more...', $result->node_data_field_pager_item_text_field_[replace]_value);
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }

Hope this helps you further, please let me know.

cvaughn13’s picture

I double-checked and the machine-readable field name is "field_url" Does it make a difference that I am using the modest-grey10p template? I've attached the template files, my css file, and the page source of the page with the slideshow. As you can see, the Read more button is not being printed.

Also, I am not getting the drupal debug messages to show up. I uncomment them set message lines, save the template file, then go back to the page with the slideshow and it doesn't appear. The only difference is that the read more button is gone.

Any other suggestions?

ppblaauw’s picture

Just to test if the code is used, change:

          // add slide_read_more variable and slide_node variable
          if (isset($result->node_data_field_pager_item_text_field_url_value)) {
            $slider_items[$key1]['slide_read_more'] =  l('Read more...', $result->node_data_field_pager_item_text_field_url_value);
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }

to

          // add slide_read_more variable and slide_node variable
          $slider_items[$key1]['slide_read_more'] =  l('Read more...', 'http://ddblock.myalbums.biz');

Your readmore button should show up and always link to ddblock.myalbums.biz

cvaughn13’s picture

Yes, that did work. The "Read more..." button came back on and linked to ddblock.myalbums.biz. Perhaps something is wrong with my view or CCK content type? Should I try to re-create the Url field?

I though perhaps it was a permission issue, but I allowed both anonymous and authenticated users to see the "field_url" values and it still didn't come up.

Any thoughts?

Thank you for all you assistance. Your module is really great.

Best,

ppblaauw’s picture

ok, we know now the code of the preprocess functions in the template.php file is used.

Its still strange that the result of the drupal_set_message lines are not show in the page.

The only issue is: What needs to be the fieldname for your url field?
I assume you added the field to the view.
Can you also see the fieldname fo the URL field in the preview of the view?

Maybe that way we can find out the fieldname.

cvaughn13’s picture

here's the text from the preview on the view. Does this help? I set the Url field to my homepage just to test it.

Title: Hedda Gabler
Pager item text: Hedda Gabler
Url: http://localhost/drupal-6.13/
Slide text:
"one of Raven's best...." - Chicago Tribune
Image:
image/jpeg icon
hedda1.jpg
Body:
Title: Night of the Iguana
Pager item text: A Classic Reborn
Url: http://localhost/drupal-6.13/
Slide text:
Subscribe now and save!
Image:
image/jpeg icon
hedda2.jpg
Body:

Query

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_url.field_url_value AS node_data_field_url_field_url_value,
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 content_field_url node_data_field_url ON node.vid = node_data_field_url.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.type in ('ddblock_news_item')) AND (node.status <> 0)
ORDER BY node_created ASC

Title News item slideshow
Path This display has no path.
Query build time 5.03 ms
Query execute time 0.69 ms
View render time 31.1 ms

ppblaauw’s picture

Yes,

The field_name needs to be:

node_data_field_url_field_url_value

so the code will become:

          // add slide_read_more variable and slide_node variable
          if (isset($result->node_data_field_url_field_url_value)) {
            $slider_items[$key1]['slide_read_more'] =  l('Read more...', $result->node_data_field_url_field_url_value);
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }
cvaughn13’s picture

Yep, that worked! Thank you so very much for your help and patience! Once I get the website published, I'll be sure to add it to the list of websites using ddblock.

Thanks again!

ppblaauw’s picture

Title: "Read more..." button disappears » "Read more..." button disappears, when I link it to other pages
Status: Postponed (maintainer needs more info) » Fixed
Issue tags: +preprocess functions

Set status to fixed.
Add tag
Changed Issue Title to make it more useful for other users
Looking forward to the result.

Status: Fixed » Closed (fixed)
Issue tags: -preprocess functions

Automatically closed -- issue fixed for 2 weeks with no activity.