Jump to content

ukscotth

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by ukscotth

  1. Hi, I have the following code which gives a fading out effect when clicking on links. I need to be able to disable it for anchor links so it is disabled when using # as the link. Any ideas ? /* * Function to animate leaving a page */ $.fn.leavePage = function() { this.click(function(event){ // Don't go to the next page yet. event.preventDefault(); linkLocation = this.href; // Fade out this page first. $('body').fadeOut(400, function(){ // Then go to the next page. window.location = linkLocation; }); }); }; Thanks, Scott.
  2. The above code was just an example. Im simply trying to learn how to use variables in commands. In php I would use quotes and dots such as echo 'hello'.$world Is there a similar way in batch scripting ?
  3. Sorry I meant how would I do the code I attached correctly
  4. #!/bin/bash clear echo "Enter username :" read username cd / cd /home/$username/ Hi, I'm new to batch scripting and i'm trying to insert a variable into a command but cant get it working, can someone please tell me how I do the following properly : Thanks in advance.
  5. Thanks but where do i login as root, in phpmyadmin or putty ? sorry for being dumb lol
  6. Sorry I meant CPU. How can I see the slow query log ? also I can access the processlist through phpmyadmin but only when im logged in as a user, is there a way to do it for all users ? Thanks.
  7. Hi, Recently I have been getting emails warning me of a high system load ( up in the 20s ). I look at the processes and its always mysql thats using all the cpu. I have been fixing the problem by simply rebooting the server which obviously isnt the right thing to do. Can anyone please tell me how I can find out what site and user it is that is causing the high cpu load when it happens ? Many thanks, Scott.
  8. Hi, Anyone know how I can replicate the fading effect thats on the contact us button half way down the page on this site : http://themes.goodlayers.com/goodspace/ Id like to be able to do it with a button if possible but Im having troubles Any ideas ? Thanks, Scott.
  9. Please ignore this. I worked it out. Thanks.
  10. Hi, I'm trying to create a custom theme for Opencart but Im having troubles extracting the telephone number from the database to include it in my header. Opencart confuses me in the way that it uses controller files and I think each controller file links to individual tpl files so the telephone number variable can only be used on the contact page etc. It wont let me use it in the header file. Is there an easy way I can use the telephone variable in my header file ? I will paste the contact controller code below if anyone can help it would be most appreciated. Thanks, Scott. <?php class ControllerInformationContact extends Controller { private $error = array(); public function index() { $this->language->load('information/contact'); $this->document->setTitle($this->language->get('heading_title')); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $mail = new Mail(); $mail->protocol = $this->config->get('config_mail_protocol'); $mail->parameter = $this->config->get('config_mail_parameter'); $mail->hostname = $this->config->get('config_smtp_host'); $mail->username = $this->config->get('config_smtp_username'); $mail->password = $this->config->get('config_smtp_password'); $mail->port = $this->config->get('config_smtp_port'); $mail->timeout = $this->config->get('config_smtp_timeout'); $mail->setTo($this->config->get('config_email')); $mail->setFrom($this->request->post['email']); $mail->setSender($this->request->post['name']); $mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8')); $mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8'))); $mail->send(); $this->redirect($this->url->link('information/contact/success')); } $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false ); $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('information/contact'), 'separator' => $this->language->get('text_separator') ); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_location'] = $this->language->get('text_location'); $this->data['text_contact'] = $this->language->get('text_contact'); $this->data['text_address'] = $this->language->get('text_address'); $this->data['text_telephone'] = $this->language->get('text_telephone'); $this->data['text_fax'] = $this->language->get('text_fax'); $this->data['entry_name'] = $this->language->get('entry_name'); $this->data['entry_email'] = $this->language->get('entry_email'); $this->data['entry_enquiry'] = $this->language->get('entry_enquiry'); $this->data['entry_captcha'] = $this->language->get('entry_captcha'); if (isset($this->error['name'])) { $this->data['error_name'] = $this->error['name']; } else { $this->data['error_name'] = ''; } if (isset($this->error['email'])) { $this->data['error_email'] = $this->error['email']; } else { $this->data['error_email'] = ''; } if (isset($this->error['enquiry'])) { $this->data['error_enquiry'] = $this->error['enquiry']; } else { $this->data['error_enquiry'] = ''; } if (isset($this->error['captcha'])) { $this->data['error_captcha'] = $this->error['captcha']; } else { $this->data['error_captcha'] = ''; } $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['action'] = $this->url->link('information/contact'); $this->data['store'] = $this->config->get('config_name'); $this->data['address'] = nl2br($this->config->get('config_address')); $this->data['telephone'] = $this->config->get('config_telephone'); $this->data['fax'] = $this->config->get('config_fax'); if (isset($this->request->post['name'])) { $this->data['name'] = $this->request->post['name']; } else { $this->data['name'] = $this->customer->getFirstName(); } if (isset($this->request->post['email'])) { $this->data['email'] = $this->request->post['email']; } else { $this->data['email'] = $this->customer->getEmail(); } if (isset($this->request->post['enquiry'])) { $this->data['enquiry'] = $this->request->post['enquiry']; } else { $this->data['enquiry'] = ''; } if (isset($this->request->post['captcha'])) { $this->data['captcha'] = $this->request->post['captcha']; } else { $this->data['captcha'] = ''; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/contact.tpl')) { $this->template = $this->config->get('config_template') . '/template/information/contact.tpl'; } else { $this->template = 'default/template/information/contact.tpl'; } $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header' ); $this->response->setOutput($this->render()); } public function success() { $this->language->load('information/contact'); $this->document->setTitle($this->language->get('heading_title')); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false ); $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('information/contact'), 'separator' => $this->language->get('text_separator') ); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_message'] = $this->language->get('text_message'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['continue'] = $this->url->link('common/home'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/success.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/success.tpl'; } else { $this->template = 'default/template/common/success.tpl'; } $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header' ); $this->response->setOutput($this->render()); } private function validate() { if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) { $this->error['name'] = $this->language->get('error_name'); } if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['email'])) { $this->error['email'] = $this->language->get('error_email'); } if ((utf8_strlen($this->request->post['enquiry']) < 10) || (utf8_strlen($this->request->post['enquiry']) > 3000)) { $this->error['enquiry'] = $this->language->get('error_enquiry'); } if (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) { $this->error['captcha'] = $this->language->get('error_captcha'); } if (!$this->error) { return true; } else { return false; } } public function captcha() { $this->load->library('captcha'); $captcha = new Captcha(); $this->session->data['captcha'] = $captcha->getCode(); $captcha->showImage(); } } ?>
  11. Hi, Im using the Superfish menu and im trying to workout how to make the submenus 100% width so each submenu fills the whole width of the page (960px). Any ideas ? im stumped Thanks, Scott.
  12. ahh ok great. Il give it a try later. Thanks for your help.
  13. Ok great thanks very much. Would $title be the url ? e.g mysite.com/title.html
  14. Hi All, I've been creating sites with custom CMS for a while now and I'm trying to figure out how to let clients create new pages from within the CMS and what the standard method is to do it. I guess it would use mod rewrite but I'm not sure. Any ideas ? Thanks, Scott.
  15. Hi, I have a server setup which has been working fine for a couple of years now and has hundreds of sites on it. I'm trying to setup a new site for a client and ive asked him to set the nameservers for his domain to my nameservers but hes telling me he cant and that its telling him the nameservers are not configured for his domain. Never had this problem before, any ideas ? Many thanks, Scott.
  16. Hi, I have a function that pulls a random line from a text file and I would like to change it so it pulls a random line from a text file that contains a certain date, heres the current function : function RandomLine($filename) { $lines = file($filename) ; return $lines[array_rand($lines)] ; } Any ideas on the best way to do this ? Many thanks.
  17. Thanks Wayne. The client is still saying they cant acess the site. Can someone else please confirm that it is working please ?
  18. Hi, I have uploaded a website for someone but they are having problems viewing it and are telling me that nothing comes up. Not sure if its a dns problem. The domain was registered 2 days ago. Can a couple of you please check and tell me if this site loads up, it should show an ecommerce website : http://www.cassellmotors.com Many thanks, Scott
  19. Thanks. I did read the manual but im new to using arrays so it didnt make much sense to me. Thanks again.
  20. Hi all, I have the following : print_r($fqlResult); Which gives the following result : Array ( [0] => Array ( [src_big] => http://a5.sphotos.ak.fbcdn.net/hphotos-ak-ash4/299117_2121699756933_1079004376_2442101_3103384_n.jpg ) ) I want to grab just the image url from it and store it in a seperate variable. Any ideas how I can do this plzzz ? Thanks in advance, Scott.
  21. Hi, Im creating a facebook app and I want to be able to grab the users full size profile picture and save it locally. Apparently you can do it with this code : <script> FB.api('/me/albums', function(response) { for (album in response.data) { if (response.data[album].name == "Profile Pictures") { FB.api(response.data[album].id + "/photos", function(response) { image = response.data[0].images[0].source; }); } } }); </script> Sorry if this is a stupid question but how would I echo out the image path after funning that ? Im only used to working with php. Thanks, Scott.
  22. Thanks for your reply. Its working now, I swear thats what I tried before but I must of been doing something wrong. Thanks again.
  23. also need to add ' WHERE uid != $user' somehow. Any ideas ?
  24. Hi, This is probably very easy for someone who knows how but I cant seem to get it working. Can someone please tell me how I can alter this query to select a 'WHERE gender = female' so instead of picking a random user it picks a random female user ? $offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `users` "); $offset_row = mysql_fetch_object( $offset_result ); $offset = $offset_row->offset; $user1b = mysql_query( " SELECT * FROM `users` LIMIT $offset, 1 " ); $user1= mysql_fetch_array($user1b); Also, would it be easy to modify it so it picks a second random user that isnt the same as the first user ? so I end up with 2 random females ( $user1 and $user2 ) Many thanks, Scott
×
×
  • 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.