I have block view that should be rendered in the node details page. i.e /node/*
. The block should render latest 6 nodes published under the Category category_field
that the node has its value.
However, the URL is rewritten and the category id tid
is not available. The URL is looks like the following:
http://example.com/Category/world/the-node-title
So the contextual filter is not available in the URL. So, I created the following PHP code, shown in the screen shot, to get the category tid and return it:
In the node.tpl.php
when I try to var_dump($node->field_category['und'][0]['tid']);
it returns the number of tid
of the current node. However, the above demonstrated code seems to be not work in the PHP filter code. When I try to return any available value for an category id such as 19
for example, it works.
In other words, how could I return the current node's category field id to the filter?