I have many pages in the content section of Umbraco but some of the pages I would like to organize for departmental reference not necessarily for hierarchical site reference. For example, my pages might be A, B, C, D ... Z on the website but on the backend we have various teams that need their content grouped together. i.e. Team 1 folder has A-G in it. Team 2 folder has H-Q. Team 3 has R-Z in it. How can this be achieved so instead of seeing all the content on the root of the content page I only see these 3 team folders?
You have to be carefull in achieving this. When you create new nodes under your Home root node, eg new pages or folders, they are referenced with an url.
So If you have a page called A, this will be accessed using the url http://www.example.com/a. When you create folders to organize pages and you place page A under HQ, then your page will now be accessed by http://www.example.com/hq/a.
After that you can use url rewriting rules to avaid these folders indications in your url but that will be messed up if you have many pages.
I will suggest if you don't want to see these folder indications in your url, to just add all the nodes under your Home node and using Permission to allow/disallow departments to the nodes.
If you don't care about the folder indications in your url, let me know then I will edit this answer with the solution to achieve this.
EDIT
How to add folder structure in your content nodes.
Step 1
Create a new Document Type called Content Folder.
Go to Settings > Document Types > click on the 3 dots > Create.
Give it the name Content Folder.
As icon select the folder icon
Add a new property Redirect with alias umbracoRedirect with type Content Picker
Save changes
The builtin property umbracoRedirect is used to redirect one node to
another using its id. So for each folder set this property to the first child page.
Step 2
Allow your child node types in this folder.
Go to the structure tab of your Content Folder property
Check the child types that you want to allow under this folder
Save changes
Step 3
Allow this folder under your root Home node.
Go to the structure tab of your Home root property
Check the ContentFoldertype to allow as a child
Save changes
Step 4
Add you folder structure and add pages.
Go to your content
Add a new folder under your root node of type Content Folder
Give it the name HQ
Add a new page called A that's allowed under your folder
In your HQ set the Redirect property to your first A page
Do this for all your folders and pages
Save changes and publish
And thats it!
Another way of doing this is with a custom URL Provider and Content Finder. This is where you create a new provider for working out the URL of the pages on your site, overriding the default folder structure.
You can add your own logic out strip out folders from the URLS, so /folder/a/content could become /folder/content. Obviously you'd need to be careful that the other folders don't contain items with the same names, or you may get the wrong content returned.
The advantage of a URL Provider is that whenever you call the Umbraco methods to get the URL of a content item, you'll ALWAYS get the custom URL.
The content finder is a way for the site to match the modified URLs back to the original content. You'll need both for it to work.
Here is a link to an in depth article about using these two in conjunction in an Umbraco site.
Related
Within Plone 4.2, how can I constrain the addable content types for all members?
All my members (400 at the momemt and growing), should have a default set of content types to be addable within there "Home" folder (/Members/mymember). That is, if mymember goes to his Home folder, there should only be a few content types like "Document", "Image" and "File" as default addadle types. All other content types like Events, Collection etc. should only be under the "More" menu item of the "Add" menu.
I thought I could just set "Use parent folder setting" for each myplone.org/Members/mymember/folder_constraintypes_form ("Restrictions" item of "Add" menu). And then from the parent myplone.org/Members/folder_constraintypes_form I would set up the default content types as I like. That is all members' Home folders could inherit from the setting in Members. However, as a plone site administrator I cannot set the standard "Allowed" and "Secondary" ("More..." menu) for the /Members/ folder. I do allow have the possibility to select either
Allow the standard types to be added
Specify types manually
That is, there is no "Specify types manually" for /Members/. So I cannot set any defaults for the parent Members folder, from which all members' Home folders could inherit in return...
Of course, I could iterate through all Members with a script and set the folder_constraintypes for each Home folder. That would set things for all old members. However, that would have to be done again for each new member.
I find it very puzzling for users to let them have 8 and more content types to be addable within there Home folder, while they only need to use 2 or 3 actually. How can I change this?
You can create a content type for your members folder. And in the manage_afteradd method set all you want.
You we'll be able to configure Plone to use your content type as member folder, this will fix your problem for new users.
For all previously created members folders, as you said, you write a script that iterate over all members folders.
The members-folder has the member_search_form-template set as default-view. This template doesn't show the link to the folder_constraintypes-template, but you can access the template by appending its name at the end of the member-folder's url.
'http://localhost:8080/yourSiteName/Members/folder_constraintypes'
Note: Don't exclude folders, otherwise the userfolders cannot be created automatically :)
We are using Plone 4.1, and would like to have a custom view of the contents in a folder.
The "Select a content item to be used as a default view in this folder" display won't work for us because we have Private subfolders which should only be listed when the logged-in user has the right permissions.
For example, we have a main folder called "IT". Inside this "IT" folder, we have subfolders called "Admin", "Users", "FAQ", etc. The "Admin" folder is not published, i.e. is private, and it should listed in the Folder display view only if the logged-in user is part of the admin group. The "Users" and "FAQ" folders are published -- so no problem here.
If we use "Select a content item to be used as a default view in this folder", the content page does not have the intelligence to list the "Admin" subfolder only when the logged-in user is part of the admin group.
We do not want to use the default views, i.e., Summary View, Standard View, Tabular View, although these views are able to list the "Admin" subfolder only when the logged-in user is part of the admin group.
Is there a way to have our own custom view which will display "Admin" subfolder when the logged-use is part of the admin group?
Yes, you can do this a couple different ways. It is recommended to do this in a theme product (or other product with a skins folder), but I will also give you instructions for doing this in the ZMI.
(1) Customize the template for one of the default views. Find the original template in Products/CMFPlone/skins/plone_content (copy the original template into your product's skins/templates folder), or in the ZMI at portal_skins > plone_content (click the customize button). Then adjust the template to your liking.
~ or ~
(2) Create a new template that will also be available in the Display dropdown. I would start by using one of the default templates so you have a good place to start from. Put the template in your product's skins/templates folder, or ZMI > portal_skins > custom folder, but this time give it a custom name. Then in portal_types > Folder, add the template id (the name without .pt) to the list of 'Available view methods'. This information can be exported to a product from portal_setup > export tab, an export the Types Tool.
Here is a product I created to add a new view to folders and collections that displays event objects in a tabular layout (something different than the default Tabular View). It's a very minimal product and should get you started on creating your own custom template.
https://bitbucket.org/paulrentschler/tabulareventsview
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
In a module development (webtv) I am providing a generic block that can be configured for its contents (playlists). On the configure form there is a list of added contents (playlists) along with links "add new playlist" and "edit" existing one placed next to each entry. As the block configuration path is: "admin/build/block/configure/[my_module_name]/[block_delta]".
And I am expecting to add/edit playlist form on a separate page and should be accessible on:
admin/build/block/configure/[my_module_name]/[block_delta]/playlist/add
and
admin/build/block/configure/[my_module_name]/[block_delta]/playlist/[playlist_id]/edit
For this I added two entries in hook_menu with page callback as drupal_get_form and page argument as form defining function.
After clearing cache and running cron, links does not server playlist add/edit page but redirects to block configure page.
What am I doing wrong? Is it possible to extend block configure page into sub pages?
The maximum allowed menu parts in a drupal(6) URL are limited to 7. In my problem I have quoted paths with 8 and 9 parts that was the issue.
admin/build/block/configure/[my_module_name]/[block_delta]/playlist/add
admin/build/block/configure/[my_module_name]/[block_delta]/playlist/[playlist_id]/edit
In Drupal 7 the limit is expanded to 9.
It can manually be changed in the file drupal/includes/menu.inc as define('MENU_MAX_PARTS', 12);
I'm looking to find a WordPress plugin that ads an upload widget to my post editor to allow me to associate images with posts.
The end result is that I can add a bit of code to my theme's single.php file that allows me to load all of the images that reside in the folder matching the post id.
If no such plugin exists, I'm looking for some help on creating one.
Here's the way it would work..
Any images uploaded to a specific post, will go into a folder named after the post id. For example, if you are editing the post with id=420, the uploaded files will go into a folder named "420". There would also need to be some way to add or remove images from the folder without leaving the post editor (though FTP could be used for this as well).
To show post specific images, the single.php file checks to see if there is a folder under wp-content/uploads matching the post id. If it finds a match, it simply loads all the images it finds in the folder.
You can already attach images to a post without including them in the main content. You can do all of this in the main Edit Post window (the first icon next to "Upload/Insert" above the text editor. They are added with the post id as parent_id parameter, so the get_children function will give you all attached files.
This will store the images in the standard /wp-content/uploads/ folder, grouped by year and month (if you checked that option in the administration page). If you want to change the upload directory, you can use the upload_dir filter (slightly outdated parameter list) and return a different upload directory, for example with the post ID. The upload_dir filter is called from wp_upload_dir(), which is called by wp_handle_upload(), which is called by media_handle_upload(), which is called from the media-upload.php file.
If you want to extend this idea and check the upload dir for new files (uploaded via FTP for example), and attach these to the post, I suggest you look into the attachment functions.