How is the Drupal path formulated? If we have a Drupal path like channel/1 or like subchannel/2/1, are channel and subchannel taxonomies? How do we look at these data in the database?
As the URLs you used as example are not standard URLs that a Drupal site without third-party module handles by default, the answer depends from the modules you installed in your Drupal site.
For example, there could be a module that handles RSS feeds; the module could return the content of a RSS feed for URLs such as example.com/channel/1 and the partial content of a RSS feed with URLs similar to example.com/subchannel/2/1.
Actually you could have created a path alias that points example.com/channel/1 to example.com/taxonomy/term/1, but for Drupal there isn't an automatic association between example.com/channel/1 and example.com/taxonomy/term/1, or any taxonomy term URL.
There is no simple answer.
Many parts of Drupal and its modules affect URLs. For example, you can use the Pathauto module to assign an arbitrary path to a particular node. If you use Views, you can specify a path to display it, and even use extra path elements as arguments.
Unfortunately, you can't just look at the database to see how the paths work.
Related
I have a problem with Wordpress, I changed my domain, but all media use the old domain.
For example :
I access my site with www.newdomain.fr
but in source code all src="" or media are with www.olddomaine.fr/wp-content/...
How can I change this ?
There are several options this can come from.
You probably have to migrate the whole database and it's serialized strings to the new domain name - for instance take a look at this Plugin Better Search Replace and replace the old domain name with the new one in your DB (don't forget to backup everything before you to this), this plugin should also handle the serialized data
If this doesn't resolve your issue you should take a look at your template code and even the css, there could be hard coded urls you have to replace (this should be considered as a bad practice and if this is the case you should build the template more dynamically)
I have have made a folderish content type called supplier_folder, which displays a list of suppliers that can be added under it, and their information. I can add it through the navigation bar, but I would like to add it programatically during setup.
I have been following the tutorial on custom installer code (http://docs.plone.org/develop/addons/components/genericsetup.html#custom-installer-code-setuphandlers-py) and have looked at creating objects programatically (http://docs.plone.org/develop/plone/content/creating.html).
Unfortunately, the second article says I need to have a folder created. How can I get around this and add the supplier_folder object at the Plone Site outside of a folder?
IIRC, only users with role Manager or Site Administrator can add content to the root of the site; you can overcome this limitation in two ways:
by using the _constructInstance method as it bypasses the permissions when creating an item
by switching roles inside your code with plone.api.env.adopt_roles
I personally prefer the second one.
you can see an example of a pretty complex setuphandlers.py in interlegis.portalmodelo.policy package.
When you create a new Plone site, it's also creating some default content types.
Look at how Plone do: https://github.com/plone/Products.CMFPlone/blob/1471828ee97a8dd84396bad4a3286be514819869/Products/CMFPlone/setuphandlers.py#L119
There are a couple of ways to achieve this. The buildin mechanism is to use GenericSetup in combination with "structure" folder as described here: http://koansys.com/tech/create-plone-initial-content-with-generic-setup
In short you need the following:
Create a folder "structure" in your Generic Setup profile (in general, under profiles/default)
Create a .objects file with the following content: "suppliers,supplier_folder"
in "structure" create a folder "suppliers" with a .properties file and content:
[DEFAULT]
title = Suppliers
description = Some usefull description text
As far as I remember this is ok for simple structures likes your. If you have complex structures with folders and sub-folders and want more specific control you probably need to write python code. I made some stuff here: https://github.com/collective/zettwerk.setup/blob/master/zettwerk/setup/structure.py
But zettwerk.setup is not yet released, but you should be able to integrate the structure.py right into your project. Than you can the handle_structure method into your setuphandlers.py and passing a structure dict like this:
handle_structure(portal, [{'id': 'suppliers', 'portal_type': 'supplier_folder'}])
The advantage of this method is, that you can also control metadata like workflow state, default page setting, portlets, local roles and some others.
We have a Tridion use case related to curated content where we are creating multimedia components for images associated with our content which are pointing to External resource types instead of uploaded resource types.
One of the issues we have run into with this use case is that despite explicitly setting the Multimedia Type for the resource, if the URL of the image has either a query string in it: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default or uses a ‘friendly url’: http://www.somewhere.com/images/myimage/ when we save the component, Tridion barfs with error messages similar to : ‘Invalid value for property 'Filename'. Unexpected file extension: jpg?w=160&h=120&mode=crop&404=default. Expecting: jpg,jpeg,jpe.’
So far, the only way we’ve been able to figure out to potentially get around this issue is to do something hacky like appending an extra query string parameter to the very end of the urls which end with the expected file extension: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default&ext=.jpg Obviously, this is not the best solution and in fact may not work for some images if the site they are being served from strictly validates the requested URL.
Does anyone have any ideas on how we can work around this issue?
Unfortunately I can't really think of an easy solution to this, since Tridion "detects" the Mime type by checking the file extension.
You could perhaps add it while saving and remove it when reading (via Event System)? Definitely a worthwhile enhancement request, to my knowledge this behavior has not been changed for the soon-coming Tridion 2013... See comment below, it has been changed for 2013.
+1 for Nuno's answer. Recognizing that the title of your question is specific to multimedia components, you may want to consider another approach which is to use normal Components, not Multimedia Components. You can create a normal component schema called something like "External Image" that has an External Url field to store your extentionless url.
Content authors will then include these images via regular component linking mechanisms in the Tridion GUI.
You will then need a custom link resolver TBB that will parse the Output item (via Regex) looking for any Tridion anchor tags <a tridion:href="tcm:x-y-z"> and for each one replace them with an <img src=...> tag where the src path would come from this linked component.
For an example of a similar approach, but with videos, and sample code for a custom link resolver TBB have a look at the code in the following post: http://www.tridiondeveloper.com/integration-sdl-tridion-jw-media-player.
After importing content from a legacy website using the Feeds module, I'm left with node bodies that contains links back to the old website.
Is there a Drupal module that will perform a one-time process to iterate through each node, manipulating the content of nodes using some custom code?
You could easily write a PHP script to step through the node_revisions table and do your processing there. If you're comfortable with custom code, it's probably the fastest way.
You could write your own module with the intent of running it once. There is a Drupal hook_init() you can utilize to fire code when a module is on, and the page is loaded up. Within that function, you can query against all the nodes in the node table with db_query, iterate over each node and do a preg_replace on the link you want to change. After modifying the $node object, use node_save($node) at the end of the loop to save the node changes.
Alternatively, you can use a module like Link Checker, Path Redirect and/or Global Redirect to link old paths to new ones and look for busted links.
I usually run an SQL query in phpMyAdmin. See my post on http://drupal.org/node/718700#comment-2616682.
A late answer, but nevertheless.
There is a pathologic module which can be used to fix links in nodes. For example, to make them absolute or to rewrite host part.
I'm very new to Drupal, and am wondering if there's an API that external programs can call to transfer text and images directly into my Drupal site.
Yes. There are several ways to accomplish this in Drupal:
If you're doing a one-time import, try the Node Import module --- this lets you import content from a CSV file.
If you want your Drupal site to provide a web-based API to which new content can be POSTed (via, for example, XMLRPC), check out the Services module.
If you want your Drupal site to periodically retrieve content from other sites (RSS feeds, for example), check out FeedAPI.
If you want to write your own PHP code to create new content, check out this article for an introduction.
Not sure what you mean by having a module for importing text, but there is one specifically for images: the Image module. Here is an excerpt from its project page:
... allows users with proper permissions to upload images into Drupal. Thumbnails and additional sizes are created automatically.
Images could be posted individually to the front page, included in stories or grouped in galleries.
Importing text can be performed directly as one of the other existing entity types.