Closed (won't fix)
Project:
Views Custom Field
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Sep 2009 at 16:49 UTC
Updated:
31 Jan 2011 at 17:50 UTC
A node title might be called "Cat In the Hat, The" so that it sorts as one would expect and not by the "The". I'm trying to use this module in D5 to reassemble the titles as we would expect them to read– "The Cat in the Hat"
I'm finding that the following PHP works:
<?php
$title = $data->node_title;
$nURL = 'node/'. $data->nid;
if (substr($title, -5)==", The"){
print l("The ".substr($title, 0, -5), $nURL);
} else {
print l( $title, $nURL);
}
?>
But this does not:
<?php
$title = $data->node_title;
$nURL = 'node/'. $data->nid;
if (substr($title, -5)==", The"){
print l("The ".substr($title, 0, -5), $nURL);
} elseif (substr($title, -3)==", A"){
print l("A ".substr($title, 0, -3), $nURL);
} else {
print l( $title, $nURL);
}
?>
I'm scratching my head to understand why that would be. Is it possible that the PHP field rejects code beyond a certain length? From what I can see the added condition is written correctly?
Comments
Comment #1
ecksley commentedI almost forgot... Thank you!!!
Comment #2
casey commented#346216: All code in long custom field is discarded
Comment #3
casey commentedD5 version is no longer supported (wasn't for a long time to be honest).