Topic: file setContent

Hello i have a problem with this code:

            $records = Table::get('galeria');
            $return = json_encode($records ,true);
            File::setContent(PLUGINS.DS.'sandbox'.DS.'lib'.DS.'../../../post/1091/forum_subdomain/api.js',$return,true);

In localhost working well but in normal web not working,Why?

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: file setContent

what exectly doesnt work ? You must debug it.

>>$records = Table::get('galeria');
?
>>$return = json_encode($records ,true);
or
>> File::setContent(PLUGINS.DS.'sandbox'.DS.'lib'.DS.'../../../post/1091/forum_subdomain/api.js',$return,true);
?

I am not a Wizard smile

Re: file setContent

Sorry sorry sorry sad
file setContent not working, in localhost working well but in we not working

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: file setContent

I have galeria.table.xml in storage and call with table::get  and now convert this in json with json_encode and now save with setContent but not working

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: file setContent

1. Are you shure that this works
$return = json_encode($records ,true);

Try to debug

Debug::dump($return);

2. is this path realy exists  PLUGINS.DS.'sandbox'.DS.'lib'.DS.'../../../post/1091/forum_subdomain/api.js'  - ?
File::setContent(PLUGINS.DS.'sandbox'.DS.'lib'.DS.'../../../post/1091/forum_subdomain/api.js',$return,true);

Try to debug

Debug::dump(PLUGINS.DS.'sandbox'.DS.'lib'.DS.'../../../post/1091/forum_subdomain/api.js');

smile

Re: file setContent

Yes i  try and working but the file not exist is created with file setcontent or this not working in web?

dump 
---------------------- 
{"xml_object":{"options":{"autoincrement":"12"},"fields":{"img":{},"title":{},"content":{},"tags":{}},"galeria":[{"id":"3","uid":"17a239f989","img":"http:\/\/www.bigissue.com\/sites\/bigissue\/files\/styles\/bigissue_main_half\/public\/rain_room.jpg","title":"Rain","content":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.","tags":"rain"},{"id":"6","uid":"990a57e7a3","img":"http:\/\/2.bp.blogspot.com\/-2T231ypSYuA\/UIsXLo1aOAI\/AAAAAAAAAGE\/0nBd5WSJx2I\/s300\/Little_Girl_Dancing_in_the_Rain_large.jpeg","title":"oto\u00f1o en mallorca","content":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.","tags":"oto\u00f1o"},{"id":"8","uid":"befb994042","img":"http:\/\/th09.deviantart.net\/fs70\/200H\/i\/2012\/143\/0\/8\/if_the_rain_comes_they_run_and_hide_their_heads_by_kajdagingeer-d50tiwa.jpg","title":"Green water","content":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.","tags":"water"},{"id":"12","uid":"caec209160","img":"http:\/\/gem106.orioncdn.co.uk.s3.amazonaws.com\/wp-content\/uploads\/2012\/07\/rain-300x200.jpg","title":"No title","content":"No title","tags":{}}]},"xml_filename":"D:\\SERVIDOR\\UniServer\\www\\monstrabeta\\storage\\database\/galeria.table.xml"}
----------------------
dump 
---------------------- 
D:\SERVIDOR\UniServer\www\monstrabeta\plugins\sandbox\lib\../../../post/1091/forum_subdomain/api.js
----------------------
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: file setContent

okey File::setContent used by Pages Plugin for e.g.
Maybe you dont have write permissions to the folder: \plugins\sandbox\lib\

and why do you try to save your file here:  \plugins\sandbox\lib\ ?

You must use \public\ or \storage\ folder

Re: file setContent

I've tried in public / and not working, and at storage/ does not function $getjson of jquery.

I will continue testing.

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: file setContent

Note: http://monstra.org/documentation/error-handling