Jump to content

Cld

New Members
  • Posts

    8
  • Joined

  • Last visited

Cld's Achievements

Member

Member (2/5)

0

Reputation

  1. Amm because its not my webpage, i am just editing it a bit. So the problem was that /m version had a different controller. And i was doing all the checking in dekstop version so if i manually entered /m it went to a different controller which didn't have the checking for mobile device. So your code works perfectly now THANK YOU A LOT
  2. Thank you for your answers i found the problem
  3. Thank you the great code requinix, but i still if i press a link with /m on my pc i still get the mobile version but still Thanks a lot because mobile version works perfectly now
  4. So i have a problem about redirectings between versions. I wrote a code which actually works well with mobile version on mobiles it goes to mobile version but it somehow doesnt work on desktop version> maybe anyone knows where the problem might be. if($this->mobiledetect->isMobile() == true){ $current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if(strpos($current_url, '/m/') !== false) { redirect($current_url); } else { $current_url = "http://" . $_SERVER['HTTP_HOST'] . '/m' . $_SERVER['REQUEST_URI']; redirect($current_url); } } else{ $current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if(strpos($current_url, '/m/') !== false){ $current_url = explode('/m/' , $current_url); $current_url = $current_url[0] . "/" . $current_url[1] ; redirect($current_url); } else{ redirect($current_url); } } If i leave the code with the last redirect web doesnt load and says too many redirects and if i delete last redirect, web still goes on mobile version if i add /m/ in url it doesnt delete the m
  5. Yes i am pressing a link /m/ so what would be the best way to still redirect it to dekstop version? Any solution here?
  6. Hello i have a little problem with my htacess i think. Redirecting is working fine until. I share my web through facebook share button on mobile device. And when i click the link on desktop i still get redirected to mobile version. That means if i add /m at the end of my url ex: www.aaa.com/m it redirects me to mobile version. Can someone help me with this prob. Here is both of my htacces files: First one root htacces: # Disable directory listing from this point Options -Indexes # Prevent viewing of htaccess file <Files ~ "^\.ht"> order allow,deny deny from all satisfy all </Files> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Redirect from www to non-www RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] # Disable rewrite for valid directory/files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #map all request urls to a specific controller method RewriteRule ^(.*)$ index.php?/{controller}/{method}/$1 [L] # deny access to evil robots site rippers offline browsers and other nasty scum #RewriteCond %{HTTP_USER_AGENT} ^Anarchie #RewriteCond %{HTTP_USER_AGENT} ^ASPSeek #RewriteCond %{HTTP_USER_AGENT} ^attach #RewriteCond %{HTTP_USER_AGENT} ^autoemailspider #RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider #RewriteCond %{HTTP_USER_AGENT} ^Xenu #RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster #RewriteCond %{HTTP_USER_AGENT} ^Zeus #RewriteRule ^.* - [F,L] </IfModule> <FilesMatch "\.(css|js|jpeg|jpg|png|gif|html|php)$"> # Cache files for 1 WEEK #Header set Cache-Control "max-age=604800, proxy-revalidate" # Remove ETags Header unset ETag FileETag None </FilesMatch> # Expires Headers <IfModule mod_expires.c> # Enable expirations #ExpiresActive On # Default directive #ExpiresDefault "access plus 1 week" # My favicon #ExpiresByType image/x-icon "access plus 1 month" # Images #ExpiresByType image/gif "access plus 1 week" #ExpiresByType image/png "access plus 1 week" #ExpiresByType image/jpg "access plus 1 week" #ExpiresByType image/jpeg "access plus 1 week" # CSS #ExpiresByType text/css "access 1 week" # Javascript #ExpiresByType application/javascript "access plus 1 week" # Add a far future Expires header for fonts #ExpiresByType application/vnd.ms-fontobject "access plus 1 year" #ExpiresByType application/x-font-ttf "access plus 1 year" #ExpiresByType application/x-font-opentype "access plus 1 year" #ExpiresByType application/x-font-woff "access plus 1 year" #ExpiresByType image/svg+xml "access plus 1 year" </IfModule> # protect against DOS attacks by limiting file upload size - 10mb LimitRequestBody 10240000 And here is /m # Disable directory listing from this point Options -Indexes # Prevent viewing of htaccess file <Files ~ "^\.ht"> order allow,deny deny from all satisfy all </Files> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /m/ # Redirect from www to non-www RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] # Disable rewrite for valid directory/files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #map all request urls to a specific controller method RewriteRule ^(.*)$ index.php?/{controller}/{method}/$1 [L] # deny access to evil robots site rippers offline browsers and other nasty scum #RewriteCond %{HTTP_USER_AGENT} ^Anarchie #RewriteCond %{HTTP_USER_AGENT} ^ASPSeek #RewriteCond %{HTTP_USER_AGENT} ^attach #RewriteCond %{HTTP_USER_AGENT} ^autoemailspider #RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider #RewriteCond %{HTTP_USER_AGENT} ^Xenu #RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster #RewriteCond %{HTTP_USER_AGENT} ^Zeus #RewriteRule ^.* - [F,L] </IfModule> <FilesMatch "\.(css|js|jpeg|jpg|png|gif|html|php)$"> # Cache files for 1 WEEK #Header set Cache-Control "max-age=604800, proxy-revalidate" # Remove ETags Header unset ETag FileETag None </FilesMatch> # Expires Headers <IfModule mod_expires.c> # Enable expirations #ExpiresActive On # Default directive #ExpiresDefault "access plus 1 week" # My favicon #ExpiresByType image/x-icon "access plus 1 month" # Images #ExpiresByType image/gif "access plus 1 week" #ExpiresByType image/png "access plus 1 week" #ExpiresByType image/jpg "access plus 1 week" #ExpiresByType image/jpeg "access plus 1 week" # CSS #ExpiresByType text/css "access 1 week" # Javascript #ExpiresByType application/javascript "access plus 1 week" # Add a far future Expires header for fonts #ExpiresByType application/vnd.ms-fontobject "access plus 1 year" #ExpiresByType application/x-font-ttf "access plus 1 year" #ExpiresByType application/x-font-opentype "access plus 1 year" #ExpiresByType application/x-font-woff "access plus 1 year" #ExpiresByType image/svg+xml "access plus 1 year" </IfModule> # protect against DOS attacks by limiting file upload size - 10mb LimitRequestBody 10240000 Could anyone tell what code and in which of these files should i write ?
  7. Hehe i made it myself simply adding a line in controller and changing the if sentence. $this->data['items_now'] = count($this->data['items']); if ( $this->data['all_items'] > $this->data['items_now'])
  8. Hello there, I have a button to load more news in web. And i need to hide that button after all the news from database is loaded. But i only got that button hidden after one press which is not all news or i cant hide it at all with my if functions. Heres my functions i use codeigniter. Controller: public function get_more_news($menu_item_id, $total){ $this->data['all_items']= $this->{$this->model}->get_items_all($menu_item_id, $this->lang_id); $this->data['total'] = $total + $this->items_per_page; $current_page = $this->input->get('page') ? (($this->input->get('page') - 1) * $this->items_per_page) - 1 : 0; $this->data['items'] = $this->{$this->model}->get_items($menu_item_id, $this->lang_id, $this->data['total'], $current_page); if ($all_items > $this->data['items']) { $this->data['hide_button'] = 1; } else { $this->data['hide_button'] = 0; } $this->data['use_thumbnails'] = $this->{$this->model}->get_variables('use_thumbnails'); $this->data['thumbnail_prefix'] = $this->{$this->model}->get_variables('thumbnail_prefix'); $this->data['directory'] = $this->{$this->model}->get_variables('directory'); $this->data['meta_data'] = $this->welcome_model->get_item_meta_data($menu_item_id, $this->lang_id, true); $this->load->view($this->theme . '/menu_modules/' . $this->module . '/loader', $this->data); } } Loader.php <div id="button_count" data-id="<?= $hide_button; ?> "style="display:none;"></div> <script> total= $('#masonry li').length; var button = $('#button_count').attr('data-id'); var button1 = Number(button); if(button1 === 0){ $('#LoadMoreNewsButton').hide(); } </script> This script hides the button instantly. Help me please
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.