Jump to content

Drongo_III

Members
  • Posts

    579
  • Joined

  • Last visited

Posts posted by Drongo_III

  1. Ahh well i can't be of much help in that case sorry :/

     

    I would have thought using ajax to prompt the ad server into refreshing your ads sounds reasonable - but that's  assuming a server setup exists to allow you to do this.

     

     

     

     

    I use ad companies, so similar to Google's adsense, I just insert the code (javascript) and they handle the rotation as pages are refreshed... or in this case, when the code is called again.

     

    Doing it in iframes is easy, just set the iframe html page to refresh at the rate that I want.

     

    It's that I don't know if Ajax would be better or run smoother.

  2. Well entirely your choice and you know your site better than i do.  I would seriously consider not using ajax for this though if you have a standard website.

     

    As i dont fully understand your setup I can't see how you'd make this work with iframes. Unless you intend to iframe in content from companies who will themselves handle all the coding their end?

     

    How exactly do companies provide their ad code to you?

     

    Presumably companies provide you with some ad creative and a url?

     

     

    1. Users are on my pages for hours at a time.

     

    2. Preloading ads doesn't seem like it would work, as I don't know how long a user is going to be on my site. Using more server resources isn't a big issue, but taking advantage of long time that users stay on a single page is. I'm simply trying to make enough money to make the current ad placements worth while, and it seems like the one thing to take advantage of for my site and the length of time users spend on pages, is to show them new ads every 5, 10 or 20 minutes.

     

    I'm fairly certain I want to use ajax or an iframe, but it seems like ajax is the slicker way to do it. Since I'm not a programmer tho, I'm concerned if this would have problems as the ajax would be rotating different ad companies ad code. Thoughts?

  3. I'm not entirely sure what you're after here. But would it not make more sense pre-load in a random selection of ads on page load?  I suggestion this for two reasons:

     

    1) What is the average time a user spends on one of your pages? I bet it's not much over 2 mins so refreshing ads via ajax is a bit pointless.

     

    2) Imagine an average person on your site. They visit, they might sit on a page and leave their browser open whilst doing something else (anywhere from a few minutes to a few hours). If that was happening for hundreds/thousands of users you'd end up making server requests via ajax every two minutes for each person - presenting users with ads when they aren't even there to see them. So you're tying up your server resources for absolutely no benefit.

     

    Personally i would preload in a range of ad urls to a javascript array and then use some other javascript/jquery to cycle them on a periodic basis.

     

    Drongo

  4. Hi Mate

     

    Probably easiest if done with jquery. Something like:

     

      <script>
      $(document).ready(function () {
      
    
    $("#FormSubmitButtonID").click(function(){
    
    		// Logic to determine the form is ok to submit. 
    
    	$('#YourFormID').hide();
    
    	$("#YourThankYouMessageDivID").show(2000);
    
    
    
      });
      
        
    });
    
    
      </script>
    
    

     

    Tapping that in off the top of my head, and i always typo javascript, but it is a simplistic example of what you want.

  5. Not sure you could use isset() because you're not refreshing the page and so not parsing anything.

     

    You're best option is probably to fire a javascript function (onsubmit) that will hide the form and display your message.

     

     

  6. Hi Guys

     

    I have a client who wants me to setup a web application to enable video conferencing for people logged into a special client area.

     

    Can anyone recommend the best direction to go with this? I've never setup anything to do with streaming live media before so I'm at a bit of a loss.

     

    Few google searches have turned up silverlight but can anyone suggest better options? i.e. flash? Or a java applet of some kind?

     

    Any advice in the right direction would be good!

     

    Drongo

  7. Hey mate

     

    This is a bit rough and ready but  it will give you the general idea. You need regular expressions for this and i've explained how you test them below:

     

    <?php
    
    $subject = "abcdc   ef";
    $pattern = '/^[a-zA-Z\s]+$/';
    
    
    // This tests the above pattern against the string provided - that would be the string from your form
    $test = preg_match($pattern, $subject);
    
    if($test == true){
    
    	echo "all ok";
    }
    
    else {
    
    echo "bad string - please retry";
    
    }
    
    
    // pre_replace will search your string for excess white space and remove it - but it will preserve single spaces
    
    $str = preg_replace('/\s\s+/', ' ', $subject);
    
    echo $str;
    
    
    

  8. Hmm i think the best solution to that will come out of you becoming much better acquainted with google maps api (which i'm not).

     

    But i would imagine your stock table (simplifying this of course) might have a related table for store locations (so every product is assigned to one or more stores). You might store the geolocations of those stores in the DB since they wont change. 

     

    Then when someone browses for say 'pumpkins' on your site, your script looks up the item, and finds the stores in which that item is located. So you now know that pumpkins are stocked in store 1 and store 2 and you have the geolocations of those stores.

     

    You might then have a "user location " function and a "distance " function.

     

    The user location function would pinpoint the user's location. The distance function would 'range check' the user's location relative to the store locations you've stored. Then you might run another function to display this data on the map (through google maps api).

     

    As i said that's all very simplified and speculative as i'm not overly familiar with google maps api but i reckon that's doable.

     

     

     

     

    Hi,

     

    Many thanks for the prompt response.  I can read through the links that you sent me and see what I can come up with.

     

    I just have one more question - How do I link the maps to my stocklist?

     

    Thanks.

  9. Very often when building your own cms people use things like this - http://www.tinymce.com/ to provide a wysyywig environment that updates the html code.

     

    You just need to code that into your site. But all of this is a big ask if you are very new to php so check out some open source cms packages.

     

    A very easy one i have used is concrete5 . Soooo easy to create a new theme and templates.

     

     

     

     

    I need this particular Ques's answare.

    Coz i know html, css & javascript.

    I wanna write a site like that i said before.

    So can u tell me which part of php or mySQL need for do that..?

  10. Not overly familiar with Google maps API as haven't really used it much.

     

    But in theory it's perefectly possible to get their location (i.e. gelocation - http://code.google.com/apis/gears/api_geolocation.html )then have a script on your site that would calculate the closest shop (if product exists) using something like google maps distance matrix thingy - http://code.google.com/apis/maps/documentation/distancematrix/ . And if you've gone that far then displaying the shop location on a google map should be a piece of apple pie!

     

     

  11. text doesn't necessarily mean it's going to be considered text by php.

     

    You can specify the type as 'number' but this is a HTML 5 thing and won't have wide support.

     

    Your best options are to either use jquery/javascript to validate at the client side (though this would fail if they didn't have JS turned on) or post your data to a validation function and use something like:

     

    
    $yourinput = $_POST['yourinput'];
    filter_var($yourinput, FILTER_VALIDATE_FLOAT)
    
    
    

    ...with a conditional to check the input validates to a float - i believe it returns true if it's valid.

     

    If not then return the user to the form with the appropriate error.

     

     

     

  12.  

    As the others have said, using the html entity will fix it in most cases and is probably the best way.

     

    I have had this issue a few times when copying text from word (even with the charset set as utf 8). I notice it happens on commas and apostrophes and sometimes the simplest fix is to delete the character and re-write it in your editor, which fixes the comma and apostrophe issue.

     

     

     

    Hi,

     

    I'm making my website, everything is going well, but now I found something weird... some characters cant display and appear like this: �

     

    I let an image here, as we know, image is worth a thousand words, so here it goes.

  13. Hi guys

     

    I hope someone can help me with an php mail issue as server setup is something i dont know very much about.

     

    I have a simple form on a client's website that sends its output via the php mail() function.

     

    The website's domain is hosted externally. They have pointed the A and @ records to my server and their MX records are set elsehwere and point to an external mail server.

     

    The issue is the form outputs works perfectly on my own email addresses but not on the client's email. At first i assumed my messages were getting spammed on the client's side but it has been confirmed that this is not the case.

     

    When i check the zone file on my server it has a default mx record setup as "theirsite.com.". And when i check the 'email delivery route' in cpanel it tells me it's directing locally to theirsite.com.

     

    I assume this is incorrect and it should actually be pointing externally. Am i right in thinking i need to setup the zone file to point at their external mail servers and this will correct the issue with delivering off the mail() function?

     

     

    Any advice is very gratefully received!

     

    Drongo

  14. If you didnt want to send the user to another page you could set the form's action to '#' which would keep them on the page. Then you could have some logic in your page to check if the form was submitted and if it was it could run whatever login function you have to verify the user. Then if they are logged in you could have some further logic to include admin elements on the current page.

     

    Something along those lines.

     

    Or you could use ajax to post to the login function and then refresh the page - but you would need to use header again for that :)

     

    But as suggested i would stick with using headers because this is just unecessarily complicating things :)

  15. i dont quite see how the value of $received is being assigned?

     

    You are adding it's value to$data and then echoing out $received - but why would that display your new value?

     

    try this to test it

     

    foreach($row['received'] as &$data) {
    
    $data += $received;
    echo $data;
    echo "<br/>";
    }
    
    
    print_r($row['received']);
    

     

    Also you need to pass data by reference or it wont change outside of the loop.

  16. This is really more client side to be honest.

     

    You just need some jquery and some logic within your jquery.

     

    specifically you'll use the .change() function to register when a new selection has been made (i.e. from your drop down) and this would fire off the code for the new piece of the form you want to display.

     

    This should point you in the right direction - http://api.jquery.com/change/

     

    You could of course load the form elements using ajax but i cant exactly see why it would be worth sapping server resources for soemthing that can be done client side :)

     

     

     

    Hey everyone,

     

    I am looking to create an advanced contact form but need someone to point me in the right direction.

     

    I need to create a customer service form and would like it to contain the usual fields e.g. Name, Email etc. but also want to include a drop down field which has a couple of options e.g. Sales Enquiry, Order Status etc.

     

    Once one of those options has been selected e.g. Order Status, I then want a further section of the form to appear where the user can input data such as their order number, order date etc.

     

    Does anyone have any ideas on how to achieve this or know of any demos/scripts which they think might help.

  17. The effect of white space is so infinitesimal that you really need never worry about it!

     

    it's better to produce readable code than bunch everything up to save a few thousandths of a millisecond...

     

    :) My two pennies...

     

     

    Do I really have to care about the amount of spaces/tabs I have in my program?

     

    Is my code good? Example:

     

    
    
    class SportListout{
    
    public $start;
    public $db;
    private $junk = 'This is junk data. Unable to find it \'s parents. It is recommended that you delete this data.';
    
    function __construct($db){
    	$this -> db = $db;
    	$this -> setStartingParent();
    }
    
    function searchListout($sp){
    	$notif = 'There are no search results that match that criteria.';
    	if(strlen($sp) > 0){
    		if(strlen($sp) < 3){
    
    

     

    This is my common text format. Is this ok or should I not make spaces in between functions?

×
×
  • 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.