In drupal I have 2 content type "events" and "news". news content type have a node reference field "field_associated_event" to select events from events content type. events have also 2 another field text field "field_url_one" and "field_url_two"
In path auto pattern for events
[node:field_url_one]/[node:field_url_two]/events
For news url I want to get this but it's not working
[node:field_url_one]/[node:field_url_two]/news/{news alias} - not working
at give result in url only : news/{news alias}
I have using entity, entity reference module but not get token to reference fields. It get only event title if I used
[node:field_associated_event]/news/{news alias}
It works fine and get event title in url.
How to get event fields in url for news page?
You need to install Entity tokens module (comes with Entity module). Then you will be able to use [node:field-associated-event:field_url_one] and [node:field-associated-event:field_url_two] tokens in your path patterns.
Note using hyphen instead of underline (i.e. correct is [node:field-associated-event], NOT [node:field_associated_event]).
Related
I was asked to capture the analytics on a website. The website is made up of 5 web pages, but I now realize that the domain is the same and the only thing that changes is the URL fragment, i.e. www.domain.com#a, www.domain.com#b. The only info that comes through to GA is the domain and it does not include the URL fragments. The tracking code I'm using is Tealium and the data is being sent back to Google Analytics. How can I set this up so that i can see the entire URL in GA including the URL fragments?
So, from Tealium's perspective we need to trigger a view event when a new fragment is loaded (if I am understanding this correctly).
If we assume that the fragment change occurs on a link click then we need to trigger the view event when the link click occurs.
From the GA perspective, we need to trigger a view that captures the new information. For a view this is likely to be location, path and title.
Therefore, we need Tealium to construct the new data points and then pass them in a view event to GA.
The simplest way to do this in Tealium (all things being equal) is via a jQuery onHandler Extension
The jQuery extension requires the following information:
jQuery selector (or selectors) to pay attention to
"Trigger On" event type (this will be Click in this example)
Tracking event type to run (View event in this case)
Variable & values to set
Tealium jQuery onHandler extension config
note it's always a good idea to set a condition on your jQuery extensions so that they only run when needed instead of all the time and everywhere
In this extension, I have set the following:
jQuery Selector: '#MyID_1, #MyID_2, #MyID_3' -- yes you can pass a list of selectors or nearly any other valid jQuery selector statement
Trigger On: 'click'
Tracking Event: 'view'
3 Variables:
a. 'page_name' : $(this).text(); //get the link text
b. 'my_url' : utag.data['dom.url']+$(this).attr('href') //building the full URL including the fragment
//utag.data['dom.url'] is a variable/datapoint that Tealium automatically generates
c. my_path : utag.data['dom.pathname']+$(this).attr('href'); //building the path
//utag.data['dom.pathname'] is a variable/datapoint that Tealium automatically generates
NOTE: make sure to set the type for each these to "JS Code" otherwise your JavaScript will be quoted out as a string.
Why these three variables? As I understand GA, these are the values it would expect for a new page view -- location/URL, path, and Title so we are constructing those values in the extension to pass them to GA on the view event.
Now, we just need to map these new variables to GA.
my_path gets mapped to page in the GA mapping toolbox
page_name gets mapped to title
location isn't a default option in the mapping toolbox so we need to add a custom destination variable called location and map my_url to it.
custom variable mapping for GA
That's how you do it from within Tealium and minimal coding. If for some reason you don't want to / can't do it inside of Tealium, this provides us with a very nice template for a custom function to add to our codebase:
`$(document.body).on('click', '#altID', function(){
utag.view({
"page_name": $(this).text(),
"my_url": utag.data['dom.url'] + $(this).attr('href'),
"my_path": utag.data['dom.pathname'] + $(this).attr('href')
})
})`
See both in action over here at CodePen.
I've created a custom module and related it to vtiger organizations module. The custom module has an uitype10 attribute to link the record to the organization.
Everything works except that the organization name field in the quick create form of my related module is not automatically filled in. What I mean is:
if I go to organizations list, click an organization, click on Contacts icon and then click on the add button to add a new contact from the organization panel, the quick create form shows the organizazion name already filled in with the organization name I currently am in.
if I go to organizations list, click an organization, click on my custom module icon and then click on the add button to add a new record from the organization panel, the quick create form shows the organization name as empty. I have to manually write the organization name in it.
What I need is that my module behaves like the contacts module, so when I add a new record from the organization panel, the field for organization name should already filled in.
Any idea on how to achieve this?
Vtiger store Relation between 2 modules in vtiger_relatedlists table and based on details in this table Create Button URL will get generated in function getCreateViewUrl() in RelationListView.php. You can get core file in modules/Vtiger/models/RelationListView.php.
Solution : Table crestel_relatedlists will have relationfieldid which store the fieldid of your organization module against relation with your module. If relationfieldid is set to "0" then you have to set it with exact fieldid which you can get from vtiger_field table.
in my drupal 7 I have 2 content-types like these:
ContentA
ContentB (with a field Entity Reference to ContentA)
In the front-end detail page of ContentA, I would love to show a block/view with a list of ContentB whose Entity Reference field is set to the current ContentA.
I made a view of type Block and added it correctly to the page, but I cannot filter ContentB based on the current ContentA.
Could you help me?
Thanks
You should add a contextual filter for the value you will use for filtering to the block View of ContentB.
Then in your contextual filter in the "When the filter value is NOT in the URL" area select "Provide default value" and Type "PHP code" (You should have enable php filter for this). In your php code area you should have the following code
$node=menu_get_object();
return $node->field_your_machine_field_name['und'][0]['target_id']; // this is the field you will use for fitlering
Hope it helps
UPDATE
The above code will work if you need to show in your block similar results with the same selection (for example similar results of ContentB with the same selection in the referencing field of ContentA ).I will not delete because you might need it also in your project.I misunderstood. Actually the solution is simpler. You should add the contextual filter to the field and in "When the filter value is NOT in the URL" area select "Provide default value" and "Provide id from url"
I'd like to use the collective.listingviews controlpanel to display an image and richtext field. I have the image field working but would like to know if there is a simpler way to retrieve the image. When I try to retrieve the richtext field I end up with a permissions error.
The details:
I have a custom dexterity content type (examplecontent) and a collection which retrieves these examplecontent types.
To display the content types I've created a custom 'listingview' for the collection, the goal is that for each retrieved item the following should be displayed:
A RichText Field named 'body'
An Image Field named 'screenshot'
This is a mockup of how the layout might behave:
To retrieve the image field I'm using the custom tal expression:
python:"<img src='%s/view/++widget++form.widgets.screenshot/##download' />" % item.getObject().absolute_url()
To retrieve the body field I'm using the custom tal expression:
python:item.getObject().body
The image field is working but the richtext field gives the following:
RichTextValue object. (Did you mean .raw or .output?)
When I change the tal expression for the richtext field to the following:
python:item.getObject().body.output
I then get the following permissions error:
Insufficient Privileges
You do not have sufficient privileges to view this page. If you believe you are receiving this message in error, contact the site administration.
First off, you should change
python:"<img src='%s/view/++widget++form.widgets.screenshot/##download' />" % item.getObject().absolute_url()
to:
python:"<img src='%s/view/++widget++form.widgets.screenshot/##download' />" % item.getURL()
Since this way means you don't have to get the full object. Note the use of the getURL() method.
For the second expression, try something like this:
item/getObject/##text-transform/body
or
python: item.getObject().restrictedTraverse('##text-transform/body')
untested
I am new to Tridion and am facing an issue with the taxonomy.
As storage we are using file system and for taxonomy we have sql db.
Now, we have created State as Category with few keywords inside it. I have created schema and a component and have selected one of the keyword for classification. This associates the keyword with the component.
Now I have used the Tridion control with the uri of the State to retreive the taxonomy. It works fine, but the component count is showing as (0) instead of (1) since only one component is added in the bracket which is the normal behavior of tridion. I have published the taxonomy as well as the component.
You need to publish the Component that is using the Keyword. As far as I can see, the control is counting items on the Content Delivery side; not items in the Content Manager. I set up a simple example using the basic tag:
<tridion:TaxonomyControl
ID="taxBasicProperties"
TaxonomyURI="tcm:1-8-512"
runat="server">
</tridion:TaxonomyControl>
Result without the component published:
Sistema operativo (0)Android (0)iOS (0)Windows (0)
Result WITH component published:
Sistema operativo (1)Android (0)iOS (0)Windows (1)