Drupal 7 link node to basic page - drupal

Ok I'll try to explain a little better.
I have created a view to display 3 items of a certain content type on homepage.
When I click each piece of content it takes me to actual content eg node22.
I need to be able to change this so when content on homepage is clicked it goes to a specific url alias I have already setup eg contact us page.
Any idea what I need to achieve this??

We really need more info on your view to answer this but here are some thoughts.
If your display type is content the title automatically links to the node page so I will assume this is not what your issue is.
If you are using fields view just select the checkbox that says: "Link this field to the original piece of content". It is available in most "node" fields such as nid and title.
From above your example is how to "link node 49 to education page" You may be just needing the path module for that. Enable the core path module and then visit the node page you want to set a custom url for. Their should be a tab called "URL Path Settings" at the bottom of the page. Spice those up a bit more by downloading and installing the path auto module and the node url wil automatically be set when you create it.

Related

How do I add a module to the text of a basic page in drupal 7?

How do I add a module to the text of a basic page in drupal 7 ?
I need some help. I am having some problems with the drupal donations module
I have done this before on this web site
http://www.arguemax.com/_drupal-7.26/content/donate-using-paypal
But now I can;t remember how I did this.
How do I put this module on a page I am creating? When I go to create the page, there does not seem to be an option to past complex tables or controls on it. I just has a large empty text area to edit the body of the text
I thnhk this is a simple thing.
I was able to find the setting for
Home >> Adminstration >> Configuration >> Web Services == PalPal donation
and that set up the control
So I know it is ready to plop into the page
How do I plop it into the page? I remember there was something like a button bar associated with the text editor for the page that allowed me to add complex items like tables and like this particular module.
As can be read in that module's Documentation, the module creates two blocks.
The steps you need to follow:
Create an empty node of any content type. You can alter the URL and attach it to a menu item as well.
Go to admin/structure/block and find the blocks your module provides.
Hit "configure" on one or both of them.
In each block's settings, in the "pages" section (bottom of your screen) select "Only the listed pages" and enter the url of the empty page you created before.

Linking to a "File type" Dexterity Content Type

We're creating a database of files on a new Plone 4.3.2 website, using eea.facetednav as the main interface. In order to have multiple searchable "tags" plus additional information like publish year, article type, etc etc, we've created custom Dexterity content types for these "files". One of the fields on the Dexterity content type is to upload the actual file.
Everything was going swimmingly UNTIL I realized...
One of the basic functionalities of linking to "files" is now broken. Whereas we would expect creating an internal link to a file will prompt opening the file or downloading it when clicked, now it just takes you to the "view" for the new Dexterity content type, where there's a link to the actual file.
This is pretty cumbersome. Has anyone done this before, or found a way to have it automatically link to download the file? If we need to disable/scrap the Dexterity content type view in favor of the direct link, that's probably fine, but bonus points if you can think of a way to make this work both ways (i.e. have a linking method that takes it to the file and a linking method that takes it to the view).
This is the page I mean by "view", in case it's unclear:
... Off the top of my head, I can think of a weird Diazo solution of making a custom template that parses this view and automatically redirects to the file link, but that seems wrong/weird. Other thoughts?
I'll go for the bonus points, though I haven't fully tested this...
First, you have to designate your file field as the content type's "primary" field. Unfortunately this option doesn't show up in the UI so you have to edit the XML version of the schema (there's a button for this in recent versions of the dexterity control panel). Add xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" as a namespace at the top, and add marshal:primary="true" to the field tag in question.
Then, find your type in portal_types and change the "Default view method" to ##download. (It usually starts out as view for Dexterity content types.) This should make the item's URL download the file rather than showing the normal view. It knows which field to use because you designated it as primary.
You can still access the normal view by adding /view to the end of the item's URL. If you want Plone to do this when linking to the type from navigation and folder contents (just like it does for built-in images and files), go to portal_properties/site_properties and add the type's id to the typesUseViewActionInListings list.
If I had to solve this problem, I'd take the "link" content type view in plone.app.contenttypes as a model.
When someone asks to see a link content type object, the view looks to see if the requestor has the Modify portal content permission on the link object. If they do, they see the conventional view, giving them the opportunity to edit. If they don't, the view returns a redirect to the target URL.
Your code would be simpler. After checking the permission, you'd only need to append ##download/field_name to get the redirect URL.

Drupal 7 creating a custom form for content publishing

I want to know how I can create a form that will be displayed in any block for publishing content from a specific content type.
Thanks
You can install formblock module and follow these steps :
Activate formfblock form module list
Go to the admininstration page of the contenttype from which the 'add' form should be made available as a block. Exple : Article
Go to the 'Form block' section. Check the box "[] Enable data entry from a block" as it says in the description this will 'make the entry form for this content type available as a block.'
Visit the block administration page to enable and configure the block containing the form.
PS : Only users with permission to create the given content type will see the block.
You can also have a look on panels or Display Suite module if you want more customization.
Hope that can help you !

Is there a Drupal module that can redirect from root URL to a certain page?

I wonder if there's a Drupal module that can do this kind of functionality: if i go to home page, it will take me to some subpath within the site. i.e. www.something.com will redirect to www.something.com/product/node/11.
I tried creating an alias and used Path redirect module but for some reason, i can't reach the expanded URL when going to home page. it will display the content of www.something.com/product/node/11 but still using www.something.com.
I'm thinking that this can only be implemented in Apache server, not inside Drupal?
Note that our purpose of doing this feature is whenever a new product is created, we want our home website to point to that (i.e. www.something.com -> www.something.com/product2/home, before www.something.com/product1/home). If this is configurable inside Drupal, the changes would be easier and can be done by a Drupal administrator.
You should be able to go to /admin/settings/site-information and set the Default Front Page at the bottom of the form. That doesn't do a redirect: the home page will BE whatever you set the default to.
Create a new view (Node type) named "frontpage_redirect"
As suggested in answer by Michael D, create and save a view configured to search for your specified criteria:
display: page display, path = frontpage-redirect
pager: 1 item
row style = Fields
fields: Node => Node ID
filters: node type = product
sort: post date desc
Save your new view
At admin/config/system/site-information, set your "Default front page" to the view display path above (frontpage-redirect in my example)
In the view edit screen select "Theme: Information" link in the Page display. Look for the most specific (rightmost) entry under "Field Node: Nid (ID: nid)" - should be something like views-view-field--frontpage-redirect--page-1--nid.tpl.php, but will depend on the view name and display name. Copy the default views template views-view.tpl.php into your theme folder using the filename from 3.
Edit the template and put this code in it:
if (isset($row->nid)) {
drupal_goto('node/' . $row->nid);
}
This way of setting up the redirect lets you drive it from Views, which gives flexibility. When your customer decides in six weeks that they want to feature only the latest red product on the frontpage, you'll be able to update the logic behind the redirect using the views UI. (And you can do it from your phone on the train home!)
You avoid the need to create a custom module (which is easy enough, but does add some complexity) or to move your site logic into .htaccess.
Using the Views module, create a new view that displays one full node, ordered by last created, filtered appropriately, then create a page display in the view. Then follow Graham's instruction to set the site homepage to the view URL.
Another way would be to write a very simple custom module that db-queries for the latest node created of the sort you want, grab the URL to the page, then redirect there using drupal_goto().
There are other ways to do what you want inside Drupal, but I can't think of any that are more direct and simple at the moment...
What you are asking seems wrong. Sorry if I misunderstand some detail, but it seems you should reconsider the problem on a higher level.
If I understand you right, you want to show the page for the latest product as the homepage?
If so, maybe you should turn that into show the latest project page on the homepage. That fits a lot better with the RESTfullness of the web. And with expectations of the users.
The pattern would then be:
GET /products/22 shows product 22
GET /products/23 shows product 23
GET /product/latest shows the last product (in this case, the page would be exactly similar to /products/23)
To achieve that, you can use views module.
On similar lines to Michael D's post, assuming you want to pull the most recently published product from a custom content type called "products," you could put something like this in your settings.php:
function yourtheme_preprocess_page(&$variables) {
$query = db_query("SELECT nid FROM {content_type_products} ORDER BY nid DESC LIMIT 1");
while ($row = db_fetch_object($query)) {
$redirect_nid = $row->nid;
}
if ($variables['is_front'] == 1) drupal_goto("/node/" . $redirect_nid);
}
modify the .htaccess file.
http://drupal.org/node/50322#comment-2456576

How to embed a node on homepage in Drupal 6?

How can I embed a node on the front page in Drupal 6. The node basically has the image upload field along with title and description. I want it to some how appear on the homepage alongwith a "views" which shows the uploaded images at the bottom.
What I want is to give the users an ability to create content which is right now available at .../node/photo/add. I want to somehow show this box which lets one create content i.e. upload photo with title and description on the homepage.
It's basically just an attempt at creating something like imageshack as an experiment.
I am pretty n00b when it comes to drupal so please be more descriptive.
Jukebox's solution works as a point-and-click method. If you want to do it with code, it's more like this:
create a glue module Handbook | Example Blog Post
turn it on in admin/build/modules
create a menu item using hook_menu() that will become the page
embed the node with node_view()
embed the view (blog post)
in admin/settings/site-information set your page to the
You can use the Node Blocks module to, well, turn your node into a block. This means that you can go to the /admin/build/block page and place your node in a particular region.
After installing the module, edit the Content Type of the node you want to turn into a block. Under Workflow Settings, Available As Block, choose Enable.
Now you can go to /admin/build/block and you can see some new blocks. Just choose the one you want and place it in the region of your choice. You can also configure that block's visibility settings from there as well.
If your planning on having a more complicated home page at any point in the future I'd highly recommend using Panels to do this. It will allow you to arrange your front page with views and nodes in a grid method.

Resources