Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,658
» Latest member: mashhadd
» Forum threads: 66,776
» Forum posts: 418,543

Full Statistics

Latest Threads
Delay in ajax response ti...
Forum: General Help
22 minutes ago
» Replies: 0   » Views: 8
Does the controller name ...
Forum: CodeIgniter 4 Discussion
4 hours ago
» Replies: 0   » Views: 24
Improve Pagination CI 3x
Forum: CodeIgniter 3.x
5 hours ago
» Replies: 2   » Views: 143
use active records in lib...
Forum: General Help
7 hours ago
» Replies: 1   » Views: 32
input post empty
Forum: General Help
Yesterday, 02:29 PM
» Replies: 9   » Views: 223
Dynamic Meta Description
Forum: General Help
Yesterday, 10:26 AM
» Replies: 1   » Views: 78
redis driver _get_lock se...
Forum: Issues
Yesterday, 09:05 AM
» Replies: 6   » Views: 166
Release date for 3.2.0?
Forum: CodeIgniter 3.x
Yesterday, 09:01 AM
» Replies: 1   » Views: 125
How do you access the $th...
Forum: CodeIgniter 4 Discussion
10-20-2017, 08:25 PM
» Replies: 7   » Views: 353
new User of CodeIgniter
Forum: Lounge
10-20-2017, 07:57 PM
» Replies: 2   » Views: 137

 
Question The output from json to PHP and MySQL and then
Posted by: snup55 - 10-16-2017, 05:05 PM - Forum: Libraries & Helpers - No Replies

Hello forum users need your help in one problem
I'm not compatible with the English translate 1
Yandex.Translator, do not judge strictly)

I need from the json string name_person_ru to have in the database

 download via for
but it adds only one actor
and I need everyone to fill in the database
tell me how I need to do
   
here is a diagram : "creators":{ 
"actor" [{"name_person_ru"}]}


function in the model:

PHP Code:
   function add_video()
 
   {
 
       $urls               $this->input->post('url');
 
       $number_of_url       sizeof($urls);
 
       for ($i 0$i$number_of_url $i++)
 
       {
 
           if ($urls[$i] != "" )
 
           {
 
               $video_id       (int) substr(parse_url($urls[$i], PHP_URL_PATH), 1);
 
               $curl = @file_get_contents('https://getmovie.cc/api/kinopoisk.json?id='.$video_id.'&token=10fa25be1d07564d93c5300eb1de4a2a');

 
               $response json_decode$curltrue );
 
               for ($i 0$i <= (count ($response["creators"]['actor']) - 1); $i++ )
 
               {
 
                   $data['actors'         $response["creators"]['actor'][$i]['name_person_ru'];
 
                 //сделал через for выводит только одного актера из списка
 
               $data['type'              'vimeo';
 
               $data['title'              $response["name_ru"];
 
               $data['description'      $response["description"];
 
               $data['duration'          $response["time_film"];
 
               $data['thumbnail'          $response["poster_film_big"];
 
               $data['country'          $response["country"];
 
               $data['year'              $response["year"];
 
               $data['genre'              $response["genre"];
 
               //$data['actors']            =    $response["creators"]['actor'][1]['name_person_ru'][''];
 
               $data['director'          $response["creators"]['director'][0]['name_person_ru'];
 
               $data['translator'          $response["studio"];
 
               $data['embed_url'          'http://getmovie.cc/serial/'.$response->id.'/';
 
               $data['category_id'      $this->input->post('category_id');
 
               $data['date'              date("d M, Y");
 
               $this->db->insert('video' $data);
 
           }
 
       }
 
   


the json file:

PHP Code:
{
 
"id":"438216",
 
"name_ru":"\u0410\u0441\u0438",
 
"rating":
{
 
   "imdb":"6.20",
 
   "imdb_num":"1128",
 
   "kp_rating":"8.319",
 
   "kp_rating_num":"482",
 
   "await_rating":null,
 
   "await_rating_count":null,
 
   "good_review":"100%",
 
   "good_review_vote_count":"1",
 
   "bad_review_vote_count":null,
 
   "neut_review_vote_count":null,
 
   "rating_url":"https:\/\/rating.kinopoisk.ru\/438216.gif"
},
 
   "studio":"Sis Yapim",
 
   "comments":null,
 
   "creators":
 
   {
 
       "actor":
 
       [
 
           {
 
           "name_person_ru":"\u0422\u0443\u0431\u0430 \u0411\u0443\u0439\u0443\u043a\u0443\u0441\u0442\u0443\u043d",
 
           },
 
           {
 
           "name_person_ru":"\u041c\u0443\u0440\u0430\u0442 \u0419\u044b\u043b\u0434\u044b\u0440\u044b\u043c",
 
           },
 
           {
 
           "name_person_ru":"\u0427\u0435\u0442\u0438\u043d \u0422\u0435\u043a\u0438\u043d\u0434\u043e\u0440",
 
           },
 
           {
 
           "name_person_ru":"\u041d\u0443\u0440 \u0421\u044e\u0440\u0435\u0440",
 
           },
 
           {
 
           "name_person_ru":"\u0421\u0435\u043b\u044c\u043c\u0430 \u042d\u0440\u0433\u0435\u0447",
 
           },
 
           {
 
           "name_person_ru":"\u0414\u0436\u0435\u043c\u0430\u043b\u044c \u0425\u044e\u043d\u0430\u043b",
 
           },
 
           {
 
           "name_person_ru":"\u0422\u044e\u043b\u0430\u0439 \u0413\u044e\u043d\u0430\u043b",
 
           },
 
           {
 
           "name_person_ru":"\u0422\u044e\u043b\u0430\u0439 \u0411\u0443\u0440\u0441\u0430",
 
           },
 
           {
 
           "name_person_ru":"\u0410\u0441\u043b\u0438\u0445\u0430\u043d \u0413\u0443\u043d\u0435\u0440",
 
           },
 
           {
 
           "name_person_ru":"\u041d\u0435\u0447\u043c\u0435\u0442\u0442\u0438\u043d \u0427\u043e\u0431\u0430\u043d\u043e\u0433\u043b\u0443",
 
           },
 
           {
 
           "name_person_ru":"\u0421\u0430\u0439\u0433\u044b\u043d \u0421\u043e\u0439\u0441\u0430\u043b",
 
           },
 
           {
 
           "name_person_ru":"Ibrahim Bozguney",
 
           },
 
           {
 
           "name_person_ru":"\u041e\u043d\u0443\u0440 \u0421\u0430\u0439\u043b\u0430\u043a",
 
           },
 
           {
 
           "name_person_ru":"\u042d\u043b\u0438\u0444 \u0421\u043e\u043d\u043c\u0435\u0437",
 
           },
 
           {
 
           "name_person_ru":"\u041a\u0435\u043d\u0430\u043d \u0411\u0430\u043b\u044c",
 
           },
 
           {
 
           "name_person_ru":"Dilara Deviren",
 
           }
 
       ],

 
   },



[Image: 1111-jpg.14574]


  Codeigniter4 needs more attention
Posted by: snoopy - 10-16-2017, 01:04 PM - Forum: CodeIgniter 4 Discussion - Replies (7)

We need a few more opinions on the Reddit thread: https://www.reddit.com/r/PHP/comments/76...attention/

Most of the users downvoted and almost no one found CI useful. Please support the thread. Thanks.


  Tutorial (Class 'App\Models\NewsModel' not found)
Posted by: Marcos Queiroz - 10-16-2017, 11:06 AM - Forum: CodeIgniter 4 Support - Replies (3)

Good morning, is anyone already testing CI4 and managed to do the documentation tutorial?

I followed the tutorial at https://bcit-ci.github.io/CodeIgniter4/t...index.html

I'm having trouble trying to use the Model, I'm getting the error that the Model class could not be found.

I'm starting to test this new version of CI, as the way we loaded the Model changed, I wonder if anyone had the problem and solved it.

Thank you very much in advance

[Image: erro_ci4.jpg]

Controller

PHP Code:
<?php

use App\Models\NewsModel;

class 
News extends \CodeIgniter\Controller
{
    public function 
index()
    {
        
$model = new NewsModel(); // --> APPPATH/Controllers\News.php at line 9

        
$data = [
                
'news'  => $model->getNews(),
                
'title' => 'News archive',
        ];

        echo 
view('Templates/Header'$data);
        echo 
view('News/Index'$data);
        echo 
view('Templates/Footer');
    }

    public function 
view($slug null)
    {
        
$model = new NewsModel();

        
$data['news'] = $model->getNews($slug);

        if (empty(
$data['news']))
        {
            throw new \
CodeIgniter\PageNotFoundException('Cannot find the page: '$slug);
        }

        
$data['title'] = $data['news']['title'];

        echo 
view('Templates/Header'$data);
        echo 
view('News/View'$data);
        echo 
view('Templates/Footer');
    }


Model

PHP Code:
<?php
class NewsModel extends \CodeIgniter\Model
{
    protected 
$table 'news';

    public function 
getNews($slug false)
    {
        if (
$slug === false)
        {
            return 
$this->findAll();
        }

        return 
$this->asArray()
        ->
where(['slug' => $slug])
        ->
first();
    }

    public function 
view($slug NULL)
    {
        
$model = new NewsModel();

        
$data['news'] = $model->getNews($slug);

        if (empty(
$data['news']))
        {
            throw new \
CodeIgniter\PageNotFoundException('Cannot find the page: '$slug);
        }

        
$data['title'] = $data['news']['title'];

        echo 
view('Templates/Header'$data);
        echo 
view('News/View'$data);
        echo 
view('Templates/Footer');
    }


Bug Form Validation validating blank values with min_length and valid_email rules
Posted by: natanfelles - 10-16-2017, 07:49 AM - Forum: General Help - Replies (17)

I need to update database table columns only if valid fields are received in the request.

If a field is received with a blank value '', the validation rules must be applicated or not?

Why is a blank value '' accepted when the min_length[5] (strlen('') equals 0, less then 5) and valid_email ('' is not a valid email address) rules are set?

If proceed the columns will be populated with blank values... But this can not happen!

How to solve this?

Please, check the code:

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

/**
 * Class Issue
 */
class Issue extends CI_Controller
{

    public function 
index()
    {
        
$this->load->library('form_validation');

        
// Test: If you add one character in username or email the validation will run and show the errors...
        
$userdata = ['username' => '''email' => ''];
        
//$userdata = $this->input->post();

        
$this->form_validation->set_data($userdata);
        
$this->form_validation->set_rules([
            [
                
'field' => 'username',
                
'label' => 'Username',
                
'rules' => 'min_length[5]|max_length[32]',
            ],
            [
                
'field' => 'email',
                
'label' => 'Email',
                
'rules' => 'valid_email',
            ],
        ]);

        if ( ! 
$this->form_validation->run())
        {
            
var_dump($this->form_validation->error_array());
            exit;
        }

        echo 
'Validated! Data to be updated: ';
        
var_dump($userdata);
    }





I see that  it is intentional. But is correct and I have not understand something?


  Pagination In search Results page Codeigniter
Posted by: nkhan - 10-16-2017, 07:13 AM - Forum: CodeIgniter 3.x - No Replies

Please have look on attachment,

As we can see in the attachment, I have made this using ajax  jquery  but I am looking for core CI based pagination in search Result page

I don't want AJAX.

Please Help out 
  
Thanks 

Nasiruddin



Attached Files Thumbnail(s)
       

  What is the confif autoload?
Posted by: yoseapero - 10-16-2017, 05:01 AM - Forum: General Help - No Replies

Hi everyone!!
Last week i just sign the framework class, and i use CodeIgniter. I want know about the config autoload in codeigniter. What is it?


  How use key for aes_encrypt wihtout accessible
Posted by: omid_student - 10-16-2017, 04:05 AM - Forum: General Help - Replies (1)

I need to use AES_ENCRYPT in mysql for decrypt data
We know that need key for encrypt and decrypt data
If i use this key in sql query from php and execute it,maybe database show error that contain my query that in query my key exist
How use this key without accessible user?


  Calling img src and alt from database
Posted by: alann - 10-16-2017, 03:23 AM - Forum: General Help - Replies (3)

Hi Everyone,

I've just started using CodeIgniter and have been enjoying it so far.

I have set a view up which is calling content from a database table and everything displays as expected for the text content.

However, I can't find a way to pass the img src and the alt description from the database table (image src in one column and alt in a separate column).

I can display images by calling the image direct from the /assets/images folder prefixed with "echo base_url" so I know it is the string I'm getting wrong.

I've tried searching the forum to no avail and Google examples haven't worked.

The view I have is:

Code:
<h2><?php echo $title; ?></h2>

<?php foreach ($accessories as $accessories_item): ?>

<div class="row" style="border: 1px solid #ccc; padding-top: 5px; margin-bottom: 10px;">
   <div class="col-md-3">
       <img src="<?php echo base_url('assets/images/061.jpg'); ?>" alt="MTH-061" />/* This is where I'm stuck*/
   </div>
   
   <div class="col-md-6">
       <h4><?php echo $accessories_item['title']; ?></h4>
       <p><?php echo $accessories_item['description']; ?></p>
       <p><?php echo $accessories_item['subdescription']; ?></p>
       <p><strong><p><?php echo $accessories_item['subnote']; ?></p></strong></p>
   </div>
   
   <div class="col-md-3 text-right">
       <p>£ <?php echo $accessories_item['price']; ?></p>
   </div>

</div>

<?php endforeach; ?>

Any help, guidance or link to a help resource would be greatly appreciated...

My apologies if this has already been covered as it seems so simple!

Thank you in advance,

Best regards,

Alan


  More than two parameters
Posted by: ichiparanoid - 10-15-2017, 09:45 PM - Forum: Model-View-Controller - Replies (2)

Hi, people!!

In first place, excuse me for my english (i'm from Colombia).
I'm a PHP developer but is my first experience with Codeigniter (i love it!). I need pass three parameters in a rute like this:

https://mydomain.com/myapp/Controller/fu...am2/param3

With two parameters is all perfect but is not working with three. ¿Is not possible? ¿suggestions?

Thanks!!


  File upload + Post
Posted by: Piotr - 10-15-2017, 04:46 PM - Forum: CodeIgniter 3.x - No Replies

Hello
I upload file using upload lib, everything works ok but i want add also file description so i send it with file via post variable. In controller there is no any post variables. $this->input->post() is return empty array. Is there a security issue sending post + upload? Is there a way to send post variables with uploaded fille at the same time?

Sorry for my english



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.