Unable to add/edit pages and articles

Unable to add/edit pages and articles, a forum discussion on Jojo CMS. Join us for more discussions on Unable to add/edit pages and articles on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS
Rick Rick

27 Feb 2008
Posts: 336

Hi guys,

When I select 'Edit Pages' from the menu the edit page screen comes up with 'page' as the only entry in the list on the left. If I've clicked a content page on the admin home screen under 'Quick Tasks' then I get the same result except the page data is loaded into the fields. Saving doesn't work.

I opened up FireBug and the response to the Post on load was "Call to undefined function json_encode() in E:\wwwroot\_jojo\plugins\jojo_core\json\admin-edit-nodes.php on line 54".

When editing articles, the list on the left is populated and there's no error in FireBug, however the fields also remain empty. Same deal with the tags section.

I've tried a completely fresh upload/install (JoJo v1.0b1) and I'm open to suggestions... any ideas?
Harvey

Core Developer

Harvey

27 Feb 2008
Posts: 327

Hi Rick,

This problem is known to happen on PHP4 - can you please double check that you are running PHP5?

Cheers,

Harvey.
Rick Rick

28 Feb 2008
Posts: 336

Thanks for the quick reply... Yup, PHP Version 5.1.4

I can email you the PHPInfo link if there's anything useful in it. I'm happy to help in any way I can.
Harvey

Core Developer

Harvey

28 Feb 2008
Posts: 327

Hi Rick,

Unfortunately, the json_encode function used here does require PHP 5.2 or greater, as does Jojo (see GoPHP5 info or docs on system requirements).

Having said that, I might be able to get you a workaround to get the site working (but won't include the drag-drop functionality of the treemenu). We have been chucking PHP5 code into Jojo all month, but I don't think we have added too much PHP5.2 code.

I'll check this out and get back to you.

Cheers,

Harvey.
Rick Rick

28 Feb 2008
Posts: 336

Don't go out of your way for me, it's my fault for not reading enough into the GoPHP5 initiative.

I'll work on getting the server upgraded, or shift it to a less convenient one with PHP 5.2.3 on it.

Thanks for your time :)
mikec

Lead Developer

mikec

28 Feb 2008
Posts: 67

There are a number of PHP 5.2 features/functions in use in Jojo now.

It's probably possible that you could get it to work in 5.1 if you implemented the missing functions in PHP and included those somewhere.

- Mike
Rick Rick

28 Feb 2008
Posts: 336

It's for my personal site on our own server, so I'll work on getting the go-ahead to upgrade it. Meanwhile I'll track down a list of missing functions.

Thanks for your help guys... I'm loving Jojo and am looking forward to playing round with the plugin api.
Rick Rick

29 Feb 2008
Posts: 336

Hi Mike,

I jumped in and wrote a quick function to replace json_encode() however it still doesn't work. The only thing I can think of is maybe I'm using the wrong values for bools on the leaf values.

The data I get back is...


[[0:[["text":"Articles","id":35,"leaf":0,"iconCls":"folder","cls":"file","editable":1]]
,1:[["text":"Contact","id":34,"leaf":1,"iconCls":"file","cls":"file","editable":1]]
,2:[["text":"Home","id":1,"leaf":1,"iconCls":"file","cls":"file","editable":1]]
,3:[["text":"Sitemap","id":31,"leaf":1,"iconCls":"file","cls":"file","editable":1]]
,4:[["text":"Admin","id":2,"leaf":0,"iconCls":"folder","cls":"file","editable":1]]
,5:[["text":"Login","id":19,"leaf":1,"iconCls":"file","cls":"file","editable":1]]
,6:[["text":"Not on Menu","id":23,"leaf":0,"iconCls":"folder","cls":"file","editable":1]]]]


I've tried 1/0's, true/false's with no luck. Is there any chance of getting the demo site unlocked so I can see the expected output?

If anyone else needs it...


// json_encode() is not in PHP 5.1.2
if (!function_exists('json_encode'))
function json_encode($arr)
if (!is_array($arr)) return false;
$values = array();
foreach ($arr AS $k => $v)
$values[] = json_encode_type($k).':'.json_encode_type($v);
]]
$values = implode(',', $values);
$output = '[['.$values.']]';
return $output;
]]
]]
function json_encode_type($var)
if (is_numeric($var)) return $var;
if ($var === true) return 1;
if ($var === false) return 0;
if (is_string($var)) return '"'.$var.'"';
if (is_array($var)) return json_encode($var);
]]

Edit: Replace every '[[' and ']]' with open/close braces
mikec

Lead Developer

mikec

3 Mar 2008
Posts: 67

Hi Rick,

See this change, where we removed the work around for < php 5.2, which will show you how we used to do it:

http://groups.google.com/group/jojo-svn/browse_thread/thread/3c3171309d35eb37/1198bddac1e5200a

- Mike
Rick Rick

3 Mar 2008
Posts: 336

Thanks for your help, Mike. I've got it working great now thanks to the link you provided :)
Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.