-
Why did my site loose its Google sitelinks after being improved & updated?
Major_Disaster replied to Major_Disaster's topic in SEO (Search Engine Optimisation) & Search Engines@Renaissance-Design - yes i did. Just like magic i have woken up and i now have sitelinks?! Can others follow the link to confirm the same result?
-
Why did my site loose its Google sitelinks after being improved & updated?
Major_Disaster replied to Major_Disaster's topic in SEO (Search Engine Optimisation) & Search EnginesThanks for the response. Yeah i noticed - but they are no replacement for sitelinks! I just thought because the domain was reasonably old, G would trust it and restore sitelinks reasonably quickly. Ive made a fair few changes to the site today (adding / removing H1, H2 and H3, removing links from the index and most importantly removing the /products/ folder). Hopefully Google will approve of the changes...
-
Why did my site loose its Google sitelinks after being improved & updated?
EDIT: Woops - just seen the sticky. Please move to Google sub forum. My bad Hey all, I had an old rather shoddy site that had managed to pick up Google sitelinks which I was very happy with. I redesigned and massively expanded the site (from a 20 page site to a 300+ one) and noticed that very soon after uploading the new design my sitelinks were gone. I have waited a couple of months now to see if they came (as G got used to the new layout), but there is no sign and I'm wondering why Google is "penalising" my new site when in my eyes it is so much better (in terms of content and SEO)? The search is here Any ideas or suggestions about how to get my sitelinks back? I did worry that there may be too many internal links on the homepage (with the footer) and big G thought my site may be spammy? But the fundamentals such as decent content and site structure are all there (if you ask me anyway!) Cheers for the suggestions
-
-
-
Major_Disaster reacted to a post in a topic:
PHP / Ajax Contact form - how do i display each error with its input and not in one?
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Poo.Thats what i had and was working. I tried to change to one page as i was under the impression that was preferred for some reason...time to undo a day's work! Cheers for the help
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Thank you that worked - even though i dont undertsna dwhy! I was wondering, im trying to get all the code on one page (as you suggested earlier), however, i cant get it to work with ajax. Because the ajax is calling itself, it seems to return the whole page and completely messes up the form (if that makes any sense)? Any ideas? Or should i just stick with two pages? (ie are there any major / specific advantages two have a single page instead of two?) Cheers
-
Help with PHP sessions
EDIT: Scrap that, i didnt have the session_start() at the very top. With regards to just clearing the cache, thats why i was trying to somehow use the user's IP in the Session data? Would that work? What i want is to limit one message send per IP per 60 seconds. Any ideas? You can see my attempt in my OP
-
Help with PHP sessions
Hello all, Id really appreciate some help using sessions in my PHP contact form. What i would like to achieve is a way limiting each user to submitting the form once every 60 seconds (so im not overrun by Spam). I was thinking of creating some session based on the user's IP (or SID - but i dont really understand that) and just checking the session data. However, i dont understand fully how sessions work, this is what i currently have: //Start the session $session = session_id(); if($session == "") { session_start(); } //Check if the a message has been sent in the last 60 seconds $timeLimit = $_SESSION['lastMailed'] + 60 < time(); if (!$timeLimit && $_SERVER['REMOTE_ADDR'] = $_SESSION['ip']) { $response['error']['time'] = 'Whoah, slow down there! Please wait 60 seconds before sending another enquiry'; } //blah blah check the POST data and send the email //Start timing from when the message was sent $_SESSION['lastMailed'] = time(); $_SESSION['ip'] = $_SERVER['REMOTE_ADDR']; But PHP is giving me warnings about modifying session data. Sorry im being a bit vague, its just im not too sure what the best way to implement sessions are. I would really appreciate some help. Cheers
-
Major_Disaster reacted to a post in a topic:
Connecting to a MYSQL database in a seperate file (PHP)
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Hello again - ive spent some time working on this and i think its getting there: have a look I was wondering if you could take a look at my JS though, im trying to get jQuery to print <ul> then the errors (in <li>'s) and then a closing </ul> - however when i inspect my code in Firebug i seem to have <ul></ul> and then the errors, and i dont see why? This is the code: jQuery(document).ready(function(){ $('#recaptcha_reload_btn, #recaptcha_switch_audio_btn, #recaptcha_whatsthis_btn').attr('tabindex', -1); $('#enquiry').focus(function () { if ($(this).val().length < 125) { $(this).animate({ height: $(this).height() * 3 + "px" }, 300); } }).blur(function () { if ($(this).val().length < 125) { $(this).animate({ height: $(this).height() / 3 + "px" }, 300); } }); //On submit $('#contactform').submit(function(){ //Add disabled class and append the loading gif $('#submit').addClass('disabled').after('<img src="assets/ajax-loader.gif" class="loader" />'); //Hide any errors $('#message').slideUp(500,function() { $('#message').hide(); //Perform the AJAX call $.ajax({ type: 'POST', url: 'contact.php', dataType: 'json', cache: false, data: ({ title: $('#title').val(), firstName: $('#firstName').val(), lastName: $('#lastName').val(), email: $('#email').val(), company: $('#company').val(), country: $('#country').val(), phone: $('#phone').val(), website: $('#website').val(), enquiry: $('#enquiry').val(), recaptcha_challenge_field: $('#recaptcha_challenge_field').val(), recaptcha_response_field: $('#recaptcha_response_field').val(), gender: $('#gender').val(), submit: $('#submit').val() }), success: function(response){ if(response.status === 'error') { //Add the error class $('#message').addClass('error'); //Fill message div with the AJAX response $('#message').html(response.message); //Print the errors $('#message').append('<ul>'); $.each(response.error, function(index, value) { $('#message').append('<li>' + value + '</li>'); }); $('#message').append('</ul>'); //Show the response div $('#message').slideDown('slow'); //Remove the loading gif $('#contactform img.loader').remove(); //Remove disabled class from the submit button $('#submit').removeClass('disabled'); //Reload the reCaptcha Recaptcha.reload(); } else if (response.status === 'success') { //Add classes $('#message').removeClass('error'); $('#message').addClass('success'); //Fill message div with the AJAX response $('#message').html(response.message); //Hide the contact form $('#contactform').slideUp('slow'); //Show the response $('#message').slideDown('slow'); } else { alert('some other error'); } } }); }); //Stops the page refreshing/loading contact.php return false; }); }); var RecaptchaOptions = { theme: 'clean' }; Cheers for all the help
-
jQuery $.post works - but i cant get $.ajax to work?
Hey guys, I'd really appreciate some help. I have the following JS code (which works): EDIT: Spelt success wrong. /facepalm This doesnt work. I can see the response come in (in FireBug) but the #message div is never populated with data. Any ideas? Cheers for any help
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Thank you very much. I understand. My final (i promise!) question is what to do when JS is disabled? It seems as though for the Ajax to work, the echo json_encode($error); needs to be the final line in the script (the jquery just grabs the last line of the php file?) But when JS is disabled, i want the PHP to spit out the errors? So will need to echo out the $error array? Any ideas of general structure / psuedo code? Thanks again for all your help. EDIT: Im starting to think returning HTML instead of json would be easier in this situation?
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Thanks for all the help. Finally, im trying to get the sucess / failure messages to display from the PHP. This is what i have, but the message is not being displayed (but i can see it is coming from the PHP in firebug): $(document).ready(function(){ $("#form").submit(function(){ //When the form is submitted by the user do the following... $('.error').remove(); var dataString = $(this).serialize(); //Grab all the data input $.ajax({ //Start an AJAX request url: "mail.php", //We're using mail.php as a PHP script to send the email data: dataString, //This is the data we grabbed above type: "POST", //Well, we need to post the data to the mail.php file dataType: "json", //We will be receiving an HTML error/success message from mail.php success: function(error) //Once the AJAX request has been completed, do the following... { if(error.length > 0) { $.each(error, function(index, value) { $('input[name="' + index + '"]').after('<p class="error">' + value + '</p>'); }); } else { $('#message').html(error); //Display the message returned by the PHP script } } }); return false; //Stops the page refreshing/loading mail.php }); }); Any ideas?
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Thats great. Thanks so much. I really understand whats going on (but will have a read on the benefits of JSON). This is the final JS: $(document).ready(function(){ $("#form").submit(function(){ //When the form is submitted by the user do the following... $('p.error').remove(); var dataString = $(this).serialize(); //Grab all the data input $.ajax({ //Start an AJAX request url: "mail.php", //We're using mail.php as a PHP script to send the email data: dataString, //This is the data we grabbed above type: "POST", //Well, we need to post the data to the mail.php file dataType: "json", //We will be receiving an HTML error/success message from mail.php success: function(error) //Once the AJAX request has been completed, do the following... { $.each(error, function(index, value) { $('input[name="' + index + '"]').after('<p class="error">' + value + '</p>'); } ) // Closing bracket here } }); return false; //Stops the page refreshing/loading mail.php }); }); You can see the closing bracket. It doesnt need a semi colon right?
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Thanks for the continued help. I changed function(data) to function(error) not function(errors), becuase my PHP is json_encode($error) - is that correct? Yes i am using FireBug and its warning me of a syntax error. I can see $.each(errors, function(index, value) - the first bracket is opened but never closed. I just dont know where the correct place to close it is? Cheers again EDIT: Got it! Hooray. Now, i just need to ask you about chaining. WHere should i delete all the error elements?
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
Ok, i think im getting somewhere, but im confused with the loop (im a jQuery noob - i can read it but cant write it). Im now returning JSON from the PHP script, but do not know how to loop through it becuase i dont know what the "var errors" actually is in my code? Could someone have a look? I am echo json_encode($error); in my mail.php to send the error[] array, but i dont know how to loop through it in the JS is: $(document).ready(function(){ $("#form").submit(function(){ //When the form is submitted by the user do the following... var dataString = $(this).serialize(); //Grab all the data input $.ajax({ //Start an AJAX request url: "mail.php", //We're using mail.php as a PHP script to send the email data: dataString, //This is the data we grabbed above type: "POST", //Well, we need to post the data to the mail.php file dataType: "json", //We will be receiving an HTML error/success message from mail.php success: function(data) //Once the AJAX request has been completed, do the following... { $.each(error, function(index, value) { $('input[name="' + index + '"]').after('<p class="error">value</p>'); } //$('#message').html(data); //Display the message returned by the PHP script } }); return false; //Stops the page refreshing/loading mail.php }); }); Cheers EDIT: just seen the explaination - thanks
-
PHP / Ajax Contact form - how do i display each error with its input and not in one?
EDIT: Thinking about it, (this is the first time i have used Ajax), why do i need to return JSON? Thanks for the help. Would this method be able to degrade gracefully with JS disabled?