Drupal 7 - Print Module - Choose content to print - drupal-7

I am using the Print module in my Drupal 7 site (www.kooknet.be).
How can I choose which fields are printed in my custom content type?
I already added the "print-page" class to several HTML tags, but I can't get it to work.
Thanks.

If you have the Print module installed, you can set which fields are displayed for the 'print' view mode easily from the admin interface!
Go to the 'Manage Display' screen for your content type: /admin/structure/types/manage//display
Once you enable the Print module, you should start seeing a 'Print' display option in the collapsed list of display options available
Check that display option (and any others that are relevant to your content type) and hit 'Save'
Now you'll see that that display option is added and you can add or hide fields from it as you please!
:-)

Related

How do I display a message when no results are found in drupal 7 views

I'm global:php to display data in my views page. In case there is no data's in view that time its showing empty screen. But i want to display "no match forund" instead of empty screen.
Please make sure you have the 'Views PHP' module enabled in order to use Global:PHP.

Drupal 7: How do I extract specific field in a taxonomy page

How do I extract specific field for display in a taxonomy page?
I have a custom content type called "film" and each film has a Term Reference field called "casting". As expected I can click on a "casting" (tag) it brings me a page where all films are listed wherever this tag is associated. For expample if I click on "Kate Winslet" from movie Titanic, I land on a page http://localhost/mysite/tags/kate-winslet where other movies of Kate Winslet are listed. Up to this point everything is just fine.
I do not want Drupal to pull in and show default fields like just Title and Body in its own display format. Rather I want it so that I can display a photo from each film, year of release and of course the title and trimmed version of the body. I only want to customize the content of this page so that I have the control over What to Show and Where To Show a specific field value.
This is what I tried:
I cloned and put page.tpl.php in my theme's template folder. Renamed it as page--vocabulary--tags.tpl.php. Then I took out the following line of code (<?php print render($page['content']);?>) from my page--vocabulary--tags.tpl.php. The intention was to check whether the overridden template is actually being accessed by Drupal or not. It does!
But I am not been able to extract fields like field_photo or field_release_date from $page['content]. To get an idea about defined variables and how they are placed I used the following line of code:
<pre><?php /*print var_export(get_defined_vars(), TRUE);*/ ?></pre>. But even from there I could not extract a particular field like I mentioned above. The fields look to be somewhere inside $page['content']['system_main']['nodes'], but I don't know how to get to a specific field directly.
I also created a template.php with the following preprocess hook function:
<?php
function introduction_preprocess_page(&$vars) {
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$term = taxonomy_term_load(arg(2));
$vars['theme_hook_suggestions'][] = 'page__vocabulary__' . $term->vocabulary_machine_name;
$vars['content'] = $vars['page']['content']['system_main']['nodes'];
}
}
?>
Both <?php print render($content) ?> and <?php print render($page['content']) ?> print the same result but I want something like <?php render($content['photo_field'])?> which I am not been able to.
I am sorry for making this too long. I have just stepped into Drupal. So wanted to make sure that what I am trying to explain matches exactly what I want to accomplish.
You are probably trying the long way to this.
You can use Views module. It allows to create custom listings querying the database, but also override existent ones, like the case of the taxonomy term page listing.
Once you have the module installed (if it's not yet), particularly the Views UI module, go to /admin/structure/views and scroll to bottom, where disabled views (grayed rows) are. You'll find one called Taxonomy term, described as 'A view to emulate Drupal core's handling of taxonomy/term.'
Click Enable on the right of it and then go to the same place where the Enable link is, click the arrow to unfold and choose Edit.
Once you're in the view edit page, you can manipulate the listing at your convenience, adding/removing fields or whatever you want to do in your particular case. If you are not familiar with Views, I recommend you to learn about it, there is a lot of related content on the web and it is close to essential for Drupal development.
Also, if you want to add more customisation to the page, you can use the same approach with the Panels module, who allows to override system pages (not just listings like Views).

Drupal 7 basic page with a dynamic block with arguments

Can anyone guide me to a route to take as far as making a basic page in drupal 7 and then having that page load a block with images inside based on URL path.
So I have a content type that is for 1 type of pages and another content type for another type of page. Each content type has 30 pages. I don't want to create 30 pages for 1 page that will have the same content over and over but with a different logo.
http://www.example.com/contenttype1name/%/staticname
I need to make the menu have an argument passed and then based on what is passed go get the correct image.
Sorry if this is confusing. Thanks for your help.
You should look into the views module - it allows you to easily create a view with dynamic parameters (contextual filters) that allow you to easily tackle things like this.
I used contextual filters on views and nodesymlinks along with panels that was already installed.
Modules Used:
Views
Nodesymlinks
Panels
Step 1: admin > Modules > Add Modules/Enable.
Enable Nodesymlinks
Enable Panels and panelizer
Step 2: admin > Structure > Views > Add View.
Make view, name it and check block not page (I used Fields).
Step 3: admin > Structure > Views > your view.
Add filtered Criteria - Content type = your type.
Content should be Published only.
Add contextual filter: title.
Configure contextual filter: Content: Title.
Provide default value. Select Raw Value from URL.
Path component select 2. You can add it where you want in the URL.
Use path alias and check it.
Under More you need to check this box: Transform spaces to dashes in URL.
Check it in Views and save.
Step 4: admin > Content > Add Page.
Add a basic page.
On the bottom of the page you will see: Provide a menu link. You want to check that box. Now you will be able to add all the menu links that you wish this page to show up on. Add links/Paths and titles. Make sure you use argument 2 in your link to be your content on the views block in step 3.
Step 5: admin > config > content > panelizer.
You want to go into this pages panelizer, could be basic or whatever your content type would be. Add your views block and save.
Step 6:
Test it. If it doesn't work then you need to check your titles in argument 2 in the URL. Worked for me. Saved me a ton of time.

In Drupal 7 views how to give external link (another website) to a title?

Iam new to drupal 7 views.
I have a content type contains title, description fields. I want the content title's to scroll at the top of the page, so that i created a view and it works fine.What is my question is, i want to link a content (eg: 1st content (title) in a scroll) to another website instead of content page, the remaining contents linked to the content page. Is it possible?.If it is possible how it can be done?..
Thanks in advance,
A.John Melchior.
Yes, it's possible.
One way to do it, would be to use the Link module to create a link field in your node.
Use the link field to input the external link value.
In views add the link field, before the title ( order is important ) and exclude it from display
Add the node title field in the views and in the rewrite field output option, use one the link field token as your path.
I'm not looking at the Views UI right now , but you should find at least a couple of ways to redirect content when the node title is clicked. You should have the Rewrite field output and the Output this field as a link.
You could make use of Display Suite coupled with the description above.
Create a link field for your nodes.
Create 2 view modes for your content type via Display Suite. View Mode 1 will show the link field as the first data element, View Mode 2 will show the title as the first element.
Configure your view to show output using Display Suite, configured to show the first record using View Mode 1, all others using View Mode 2.

How to change the label of view/results buttons in Webform drupal-7

I am a newbie in drupal, webform and php. Actually I have installed the drupal-7 with the webform module and I want to modify the text of options i.e. "view" to "create project" and "Results" to "View Projects"...
I searched for solution and I noticed that best option is to create a custom module and use hook_form_alter() to modify, so I have created a custom module. But I dont know how I can modify.
Kindly excuse me if the solution is already there (I could not find it :( )
"View" and "Results" are actually menu items, which you can modify by implementing hook_menu_alter().
http://drupal.org/node/483324
The following code in a custom module (change MODULENAME to the name of your module) will update the "Results" tab without a hitch, however the "View" tab is trickier because that's the core "view node" menu item. The code below will update this menu item for ALL node types, not just webforms. If you don't see the changes, clear your cache.
As far as I know there is no way to alter menu items ("View" in this case) for specific node types. See http://drupal.org/node/754508 for some attempts and discussion.
function MODULENAME_menu_alter(&$items) {
// change webform "Results" to "View Projects"
$items['node/%webform_menu/webform-results']['title'] = t('View Projects');
// change "View" to "Create Project" - affects *all* node types, not just webforms
$items['node/%node/view']['title'] = t('Create Project');
}
Ey I found one easy way to change everything in everything drupal 7 maybe in others try the moduls to install is String Overrides, link: http://drupal.org/project/stringoverrides, then you put the name in the configuration username and the newname
I hope this information is useful
add a picture how! >> http://s2.subirimagenes.com/otros/previo/thump_7143242string.jpg

Resources