Topic: Create folder
I have a code to create a folder but I get the same name and if I leave it blank does not work.
File '. $folder.' exists
Monstra → Development → Create folder
Pages 1
I have a code to create a folder but I get the same name and if I leave it blank does not work.
File '. $folder.' exists
>> I get the same name and if I leave it blank does not work.
sorry I cant undrestand)) please explain)
I will try to explain sorry for my english.
I want create a gallery plugin in backend and i need create a folder but the name variable of the folder $folder = ' ' if left blank, not works but if I write $ folder = 'example', if it works
File '. $folder.' exists
and another question.
to save a text this is correct
// create title $photoTitle = new Table('photo_title'); if (Request::post('photoTitle')) { Table::create('photo_title', array('text', 'title')); } // create content-text $photoText = new Table('photo_text'); ; if (Request::post('photoText')) { Table::create('photo_title', array('text', 'textarea')); }
Preview Project
nakome, I am trying to reproduce your code in my local Monstra, but I cant help for the moment. If you can. Please provide this plugin to me. Than I will install it localy and test it...
// create title $photoTitle = new Table('photo_title'); if (Request::post('photoTitle')) { Table::create('photo_title', array('text', 'title')); } // create content-text $photoText = new Table('photo_text'); ; if (Request::post('photoText')) { Table::create('photo_title', array('text', 'textarea')); }
This is works fine ? I think it's not works fine....
Variant 1
When you create a new folder(gallery) You may create a new table for this gallery.
Table::create('folder_name', array('filename', 'title', 'description'));
Add new records to this table, when you upload a new images to this folder(gallery)
$table = Table::get('folder_name'); $table->insert(array('filename'=>'uploaded file name here', 'title'=>'', 'description' => ''));
Updating
$table = Table::get('folder_name'); $users->updateWhere('[filename="'.$filename.'"]', array('title'=>$title, 'description'=>$description));
Select records from current gallery
$table = Table::get('folder_name'); $records = $users->select(null, 'all'); // select all records // Loop through them foreach($records as $record) { // And you will get echo $record['filename']; echo $record['title']; echo $record['description']; }
Delete image from folder(gallery)
$table = Table::get('folder_name'); $table ->deleteWhere('[filename="'.$filename.'"]');
I'm Monstra Student Newbie
updated
/galleries.admin.php
/views/backend/index.view.php
http://rghost.ru/40632755
Thank you i will study the code
This goes out for me whenever I try to guard the table.
Call to a member function insert() on a non-object
That I do badly?
// Upload file if (Request::post('upload_file')) { $folder = Security::safeName(Request::post('folderName')); if ($_FILES['file']) { if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) { move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name'])); $table = Table::get( $folder ); $table->insert(array('filename'=>'uploaded file name here', 'title'=>'', 'description' => '')); // Redirect Request::redirect($site_url.'admin/index.php?id=galleries&path='.$path); } } }
The table is already created when I create a folder, is what I call the table and insert data.
Something I am doing wrong.
You can write me an example of how to save a text in the database.
Thanks
nakome, I will try to help you today after Work.
Thanks Awilum.
nakome, I download the lastest version of your plugin from Github and there is a problem:
https://github.com/nakome/galleries
and
https://github.com/nakome/galleries/tree/master/assets
What is that ? What changes are newest ? Please push latest changes on GitHub.
You can install SmartGIT http://www.syntevo.com/smartgit/index.html - its free
In the night i see the program, thanks
I have update "Upload file"
// Upload file // ------------------------------------- if (Request::post('upload_file')) { if ($_FILES['file']) { if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) { // Get real current folder name $current_folder_name = Security::safeName($current[count($current)-2]); $gallery = new Table($current_folder_name); $gallery->insert(array('filename' => '', 'title' => Request::post('title'), 'description' => Request::post('description'))); move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name'])); Request::redirect($site_url.'admin/index.php?id=galleries&path='.$path); } } }
Thank you, I take a look
I have a problem in line 162 Github
Call to a member function updateWhere() on a non-object
Why?
What more I is costing is view and update the database.
Well I am slowly understanding the framework.
Little by little it is running
I'm going to rewrite the plugin and use idiorm I think much better.
nakome, 5 - 7 October I was on Aikido Aikikai Seminar and I dont have access to my computer and internet... If you have some more questions to me, you are welcome.
Pages 1
Monstra → Development → Create folder