Is there a PHP code length?
ecksley - September 27, 2009 - 16:49
| Project: | Views Custom Field |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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?

#1
I almost forgot... Thank you!!!
#2
#346216: All code in long custom field is discarded