CodeIgniter Forums
Need help related to my codeigniter wallpaper script - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Need help related to my codeigniter wallpaper script (/showthread.php?tid=69652)

Pages: 1 2 3 4


RE: Need help related to my codeigniter wallpaper script - stand - 01-16-2018

@jreklund, again thank you!

You gave me the hint.

This works.

PHP Code:
$haystack = array('1','2','3','4','5','6'); 



Regards,


RE: Need help related to my codeigniter wallpaper script - stand - 01-20-2018

Hello!

A new unknown for me. Undecided

When I try to add a wallpaper to favorites, returns me this error: "Wallpaper hash doesn't exists."

I think I managed to find where's the problem, but I don't know how to solve it.

There are 2 php files that are involved here:

1st is named wall_model.php

PHP Code:
class Wall_model extends WS_model
{
 
   public function getWallpaperByHASH($hash)
 
   {
 
       $this->wallpaperTemplate();
 
       $this->db->where('w.wallpaper_hash'$hash);
 
       return $this->row();
 
   }


2nd


PHP Code:
  $hash $this->input->post('hash');
 
       $this->load->model('wall_model');
 
       $wallpaper $this->wall_model->getWallpaperByHASH($hash); // if i replace here "$hash" with the number of the hash wallpaper the favorite was successful registered.
//i think the hash is not loaded, that is why the error message. Can someone tell me if the code from "wall_model.php" is right? 

Thank you!


RE: Need help related to my codeigniter wallpaper script - Paradinight - 01-20-2018

(01-20-2018, 04:14 AM)stand Wrote: Hello!

A new unknown for me. Undecided

When I try to add a wallpaper to favorites, returns me this error: "Wallpaper hash doesn't exists."

I think I managed to find where's the problem, but I don't know how to solve it.

There are 2 php files that are involved here:

1st is named wall_model.php

PHP Code:
class Wall_model extends WS_model
{
 
   public function getWallpaperByHASH($hash)
 
   {
 
       $this->wallpaperTemplate();
 
       $this->db->where('w.wallpaper_hash'$hash);
 
       return $this->row();
 
   }


2nd


PHP Code:
  $hash $this->input->post('hash');
 
       $this->load->model('wall_model');
 
       $wallpaper $this->wall_model->getWallpaperByHASH($hash); // if i replace here "$hash" with the number of the hash wallpaper the favorite was successful registered.
//i think the hash is not loaded, that is why the error message. Can someone tell me if the code from "wall_model.php" is right? 

Thank you!

Check the $this->input->post('hash'); value


RE: Need help related to my codeigniter wallpaper script - stand - 01-20-2018

(01-20-2018, 04:51 AM)Paradinight Wrote: Check the $this->input->post('hash'); value

I'm not sure what to check at this value. Huh

To replace with something?

To delete it?


RE: Need help related to my codeigniter wallpaper script - jreklund - 01-20-2018

In the form where you "add favorites", somehow 'hash' aren't populated or incorrect value.
You need to find the file that adds 'hash' value to that page.


RE: Need help related to my codeigniter wallpaper script - stand - 01-20-2018

(01-20-2018, 06:26 AM)jreklund Wrote: In the form where you "add favorites", somehow 'hash' aren't populated or incorrect value.
You need to find the file that adds 'hash' value to that page.

Yes, just a trailing slash "/" was missing in file where send the post. (I made all URLs to be 301 redirected with an end trailing slash "/" and this one from file, don't had a "/" and every time when was called it redirects to the version with the "/" and the hash wasn't sent. I hope you understand what i meant to say Smile .

Now, once i added "/" in this file where the ajax call is made, no redirect and works.

Again, @jreklund thank you for your explanation.


RE: Need help related to my codeigniter wallpaper script - stand - 01-25-2018

Hi,

How to trim  the word "tags" from URL that is generated through this line of code:

 $config['first_url'] = $config['base_url'] . $get_method;

The URL looks like this:

_example.com/tags/tags/?page=2  [This is WRONG. The 2nd "tags" from url is wrong.]
_example.com/tags/?page=2 [This is CORRECT.]

PHP Code:
public function index()
 
   {
 
       $data = array();

 
       $data['url'] = $this->route_links->get('tags_index_page'); // the word for 'tags_index_page' is "tags" and is ok to work the tags page, but the pagination is generated wrong because of this.
 
       $this->load->model(array('wallpaper_model''category_model'));


 
       $filter['per_page'] = $config['per_page'] = $this->config->item('items_per_page') * 3;
 
       $page_number = (int)$this->input->get('page');
 
       $filter['offset'] = $data['offset'] = ($page_number ? ($page_number 1) * $config['per_page'] : 0);

 
       $data['total_count'] = $this->wallpaper_model->get_tags($filter + array('count' => true));
 
       $data['top_count'] = $this->wallpaper_model->get_tags($filter + array('top_count' => true)) * 1.3;

 
       //Initialize Pagination
 
       $config['base_url'] = $data['url'];
 
       $config['total_rows'] = $data['total_count'];
 
       $config['custom_query_string'] = true;
 
       $config['page_query_string'] = true;
 
       $config['query_string_segment'] = 'page';

 
       if (!empty($_GET)) {
 
           $get_method $this->frontend_helper->get_query_string(array('page'));
 
           $config['prefix'] = ($get_method $get_method '&' '?') . 'page=';
 
           $config['first_url'] = $config['base_url'] . $get_method// how to trim the 'tags' word that is generated in links
 
       } else {
 
           $config['prefix'] = '';
 
       }


 
   

PS: I tried to use RTRIM, but I think I didn't write in the right place and don't work.


RE: Need help related to my codeigniter wallpaper script - jreklund - 01-25-2018

rtrim will delete both /tags/tags/ and /tags/, so that's no good.

All links come from:
$data['url'] = $this->route_links->get('tags_index_page');

So it's that functions fault.


RE: Need help related to my codeigniter wallpaper script - stand - 01-25-2018

(01-25-2018, 09:09 AM)jreklund Wrote: rtrim will delete both /tags/tags/ and /tags/, so that's no good.

All links come from:
$data['url'] = $this->route_links->get('tags_index_page');

So it's that functions fault.

Thanks @jreklund , but i wondered how it works on pagination for resolutions and i found the answer:

If anyone sometime will need, for me the solution was to add " = current_url()".

$config['base_url'] = $data['url']  = current_url();

  Smile

Cheers!


RE: Need help related to my codeigniter wallpaper script - stand - 02-20-2018

Hi again!

I have a new situation that i can't find a solution. Sad

[Image: preview.jpg]


This is the code that generates the link:


Code:
<a class="good-res hide" href="<?php echo $this->route_links->build_link('wallpaper_preview', $search_replace); ?>"><i class="fa fa-eye"></i> <span class="hidden-mb">Open</span> <span class="screen_width"></span>x<span class="screen_height"></span></a>


('wallpaper_preview', $search_replace) is this: wallpaper/{W_SLUG}_{W_HASH}/{R_WIDTH}x{R_HEIGHT}


==================================

The link from html source code looks like this: uhdwallpapers.org/wallpaper/daenerys-targaryen_6548/{R_WIDTH}x{R_HEIGHT}/

What to do to be like this: uhdwallpapers.org/wallpaper/daenerys-targaryen_6548/1920x1080/

===================================


Thanks for any suggestions!