Drupal: best practice to arrange various Drupal entities into one site /subsection - drupal

It's perhaps a common task to create a subsection on site, which will reside under sitename.com/subpath.
The subsection will contain own menu with a few links (Calendar view, Add MyEvent content type form, Table View).
But clicking these links will lead out of this /subpath.
Is there a know solution for this (to stay in subsection)?
Or it's normal to use custom code to manage such a subsection, e.g. create pages under /subpath with custom PHP code that will load CCK forms (drupal_get_form())?
Also, is it a tolerable solution to modify from "View links to node forms" to "View links to /subpath pages with programmatically created node forms"?

I'm not sure I completely understood your question - if I didn't and I'm off-topic, I apologize in advance.
Anyway:
Creating pages with code in them using PHP filter, is never accepted practice. There's a reason why the filter was moved to its own module in 6.x - so you can turn it off altogether.
You can go to Site building->URL aliases->Create alias and point the wanted system paths (say, node/add/mycontent) to your subsection path (say, mysection/add/mycontent). All the links to the system path should change to the new alias.
EDIT:
Also, check out pathauto and Sub-path URL Aliases for paths like node/1 and node/1/edit

Related

Can't translate block in Drupal

I am building site in Drupal and I need your help. I have an assignment to make one more language translation of the site, and so far so good. However, I have one trouble with one block which isn't going to get translated, even though in the settings I translated it.
Also one strange activity I noticed is that when I try to go to VIEW section of all the other languages, I get dropped to front page (where that block is actually located) but if I press VIEW from my language translation (Swedish) of the block I get to completely new page.
If I go to front page and my language is selected, that block is actually using default language.
Any help what may cause it?
For desire url aliasing you need to install pathauto drupal module. then you can configure alise from below url
admin/config/search/path/patterns
OK, I have found a solution to this problem.
It appears that Drupal 7 by default sets your new language homepage to the default homepage and that's why this block was using default language since it was relying on the front page. Anyway, to fix the issue follow the steps:
Login to adming account, go to Configuration, System, Site Information and in the field Default front page for the language you have chosen navigate to your specific node page. That's it.

Dnn 2sxc Blog Module sub-directory

I am testing out DNN 8 and am using the blog app and content management from 2sxc (great module, BTW!).
I have the recent blog post listed on a page sub-directory called '/articles'. But I also wanted some of them listed on the home page as well. When I add the app or module to the home page the url is '/home/post/post-title-here' while on the /articles page the urls are '/articles/post/post-title-here'. This creates the illusion that I have two directories with duplicate blog posts (which probably will get me some dings for SEO for duplicating the same content).
How do I get the app to use the common directory '/articles' regardless of where I put the module/app on the site? I've looked at settings all over and don't see anything that pops out at me. Also not sure if this is a DNN setting or a setting specifically to the extension. Finally, I'd like to be able to keep the year/date/month parts of my url as well as they were on the old site. I assume making that change would probably be similar with the solution to my original question. If that's a different fix, then let me know and I'll put it into a new thread. Thanks in advance!
This question is basically about the blog-app. Now if I understand you correctly, your question is "Can I have multiple lists on various pages, but all of them still link to my main details page". The answer is yes, but the exact solution depends a bit on what you need.
So basically there is a setting in the app-settings to define the main page. I believe it's empty by default, so that the blog-app works automatically without you having to configure anything. But AFAIK if you set that, all blog-details-links will use that as the only source.

Is it possible to translate view path/title of custom content type?

I'm a newcomer to Drupal.
I have a Drupal installation with i18n module.
Everything works perfectly however I faced one issue.
I created custom content type and a view to display it. Now I have a quesiton... Is there any possibility to translate view path/title?
Regards,
DaveW
Well known issue for all people starting their adventure with Drupal.
How to solve the problem? It's very, very simple. I presume you have your languages created and enabled - I'll use English as default language.
Create your view with requested title and path. I always use English language as the first language, ie. news.
Go to Administration » Configuration » Search and metadata » URL aliases and create new alias by clicking Add new alias link (if this module is disable you need to enable it).
From dropdown menu, select your second (or third etc.) language, in my case Polish.
In Existing system path field provide the English path of the view you created: in our case it's news.
In Path alias field provide your translation, ie. wiadomosci for Polish language.
Voila. Now, when Polish is the current language, it will use an alias wiadomosci for news path.
Note: Just tested on fresh latest Drupal installation - works perfectly.
If you take a look here:
http://reyero.net/en/drupal/drupal7_i18n_beta1_overview (This is the module author's page)
He shows options for enabling translation of taxonomy terms, which would be the path up to your actual page - such as categories you've set up for your content.
There is also a tickbox for node, which would be your content. One would think that this would translate the either the url or the node content.
His site doesn't seem to translate to the url to spanish, but just changes menu items. The URL falls back to the node number instead of the alias which was previously displayed.
Maybe this helps or maybe this is already obvious to you, but I would tray playing with those options.
Nice overview - http://evolvingweb.ca/story/drupal-7-multilingual-whats-new-i18n
Path Translation
The Drupal 7 Path Translation Module allows you to create translation
sets for paths. Path translations are used for generic paths (for
example, for views pages), not for node or taxonomy page paths. You
can configure multilingual paths by going to Configuration » Regional
and language » Translation sets » Paths.
Seems to imply that there is a way to translate the nodes - not sure if you have to hard code or if it will happen automatically - looks promising though.
This guide might be helpful as well: http://drupal.org/node/133977
The easiest way seems to be to go with the Internationalisation Views module: https://drupal.org/project/i18nviews.

Drupal Site Index - not crawling through "Blocks"?

I created a "View"* in Drupal to grab all the content and essentially make a site map, but I realized that it doesn't have an option to grab content from the Blocks I have created. Does anyone have an idea if I can even do that?
If not, should I essentially make each block a page so that it can crawl through the pages? I worry that this will end up becoming unmanageable in the end... What are some other options/work arounds? My end goal is to make a site map - maybe I am making this too complicated?
*To make my view I did:
Administration->Structure->Views->Add. Then I made it a page, called it "site-index", and made it "show Content of type All" (with tagged field empty). Then I chose "Content: Title" for my Fields and my Filter Criteria is set as: "Content: Published (Yes):" - That way, it will grab the titles of my web pages.
Thanks, and please reply if further clarification is needed!
Apologies if I'm wrong but I think there might be a bit of confusion over terminology here. In the context of a view Content means nodes, not all HTML content on the site. Your view will return a list of all published nodes, which are essentially the pages on your site.
On a normal sitemap (if there is such a thing) you would only link to full pages, not to parts of pages like a block, they are essentially used to provide a hierarchical overview of your site to aid navigation for users and, probably more importantly these days, search engines (you can submit an XML sitemap to the major search engines instead of this but that's really for another question).
Rather than doing this yourself I'd actually recommend you download and install the Sitemap module which will do all of the work for you, as well as arranging the content in their respective hierarchy.

Add dynamic URL (or button) to each node in Drupal

I've used CCK to create a 'Travel Offer' content-type which basically just lists the details for a travel package.
My question is how to have a button or link on each node (when the user views it) that will link to a url that includes the title of the current node (eg: example.com/requestQuote/Title_Of_This_Node).
I haven't implemented my system yet so I am free to change the content-type to include a button field or something like that...
The easiest way to accomplish this would be by adding a node-your_content_type_name.tpl.php file into your theme folder. (If you haven't done this before, all you need to do is create a duplicate of node.tpl.php and rename the copy to node-your_content_type_name.tpl.php)
The '$title' variable is available within the node template, so it should be easy to craft a little bit of PHP to print out the appropriate link target.
Edit:
Now, if you want to get a little bit fancier, you could build the link to reference the unaliased node page ('example.com/requestQuote/node/11569' or whatever) and feed it through Drupal's handy l() function to build the hyperlink.
The advantage here is that you won't need to worry about the link changing if the title changes, even though l() will automatically update the actual hyperlink that's displayed to the user.
This will probably make the custom coding on your 'example.com/requestQuote' page a lot easier too, since you can work directly with the node ids and don't need to parse titles.

Resources