cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Tutorial Three

mattousai
Champ in-the-making
Champ in-the-making
Hello.

I have alfresco 2.1 installed with php 5.2.5

I am successfully able to view/use the php content templates and have also completed the first two tutorials.

The third tutorial script will display the name, node-dbid, and store-identifier, but on the fourth line (content) of the properties table, I see the following error:

Catchable fatal error: Method ContentData::__toString() must return a string value in C:\wamp\www\test.php on line 95

line 95 of that file is :

<td><?php echo $value ?></td>

why does the value of that property not return a string? any ideas?
1 REPLY 1

mattousai
Champ in-the-making
Champ in-the-making
Ok, answering my own question, in case anyone else comes across this…

the ContentData object does not have a __toString method, so in order to access the mimetype/size/etc, you have to access the properties via $value->mimetype, $value->size, etc.

i just modified that line in the test script to be something like

<td><?php
if(is_string($value))
  echo $value;
else
  echo $value->mimetype;
?></td>