-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
@jreklund, again thank you!
You gave me the hint.
This works.
PHP Code: $haystack = array('1','2','3','4','5','6');
Regards,
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
01-20-2018, 04:14 AM
(This post was last modified: 01-20-2018, 04:15 AM by stand.)
Hello!
A new unknown for me.
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!
-
Paradinight
Senior Member
-
Posts: 446
Threads: 6
Joined: Jun 2015
Reputation:
25
(01-20-2018, 04:14 AM)stand Wrote: Hello!
A new unknown for me.
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
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
(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.
To replace with something?
To delete it?
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
01-20-2018, 07:43 AM
(This post was last modified: 01-20-2018, 07:45 AM by stand.)
(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 .
Now, once i added "/" in this file where the ajax call is made, no redirect and works.
Again, @ jreklund thank you for your explanation.
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
01-25-2018, 05:56 AM
(This post was last modified: 01-25-2018, 05:57 AM by stand.)
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.
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
(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();
Cheers!
-
stand
Junior Member
-
Posts: 22
Threads: 1
Joined: Dec 2017
Reputation:
0
Hi again!
I have a new situation that i can't find a solution.
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!
|