Jump to content


Staff Alumni
  • Content count

  • Joined

  • Last visited

  • Days Won


haku last won the day on March 4 2013

haku had the most liked content!

Community Reputation

28 Good

About haku

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  1. haku

    Getting the values in Loop

    Traditionally, yes. But HTML5 introduces the 'form' attribute for form elements, which allows for the form element to not be a child of the <form> tag. Ex: <form id="someform"> <input type="text" name="some_key" /> </form> <input type="submit" form="someform" value="Submit the form" />
  2. haku

    Declare a variable

    You can also do: function someFunction(bob){ bob = bob || true; //... }
  3. Interesting idea. They would have to be scanned very regularly to keep the count current. The method I have is a little more reliable I think. But thanks for the input.
  4. I got it! I didn't figure out how to call a script in the background, but what I did was create a callback PHP script, which instead of returning the image in an image tag, serves the image directly to the browse using a force download script, setting the relevant headers etc. Now my PHP script behaves the same as when directly accessing an image, and I am able to mark the image as having been viewed before serving the image to the browser.
  5. I guess another way to explain it is that I'd like to call a PHP script in the background when files of a certain type are accessed. I want this to happen automatically through some configuration of PHP or .htaccess (or some other server config).
  6. Thanks for your reply, but the answer doesn't match the question at all. I'm not looking to detect screen size, I'm looking to call a PHP script when directlly accessing an image file.
  7. I'm working with a lightbox plugin to show images when thumbnails are clicked on. The plugin works by wrapping the thumbnail in an anchor tag that has the href as the direct path to the full-size image. This acts as a non-js fallback, so that if JS isn't present for whatever reason, the user still sees the image. When JS is enabled, the image is shown in the lighbox, resized to fit in the lightbox, which is a variable size depending on the browser. I need to keep a record of the number of times that the image has been clicked on, as thumbnails will be ordered by the number of views. The problem of course is that I'm directly linking to the image, so I can't put a script on this page. I've tried two things instead, neither of which worked: 1) Instead setting the target as the path to the image, I set it to a PHP script, then outputted the image in an <img/> tag. The problem was that the image is then not resized according to the size of the lighbox. So this is no good. 2) I set the target of the lightbox as a PHP script which recorded the viewing of the image, and redirected to the image page. This didn't work either, as the lightbox showed the data for the image (text) instead of the image itself. So, I've hit a bit of a barrier. I'm wondering if I can set something up in my PHP settings that will automatically call a script when hitting images, or maybe something in an .htaccess file that will do the same, but I'm not aware of if this can be done, nor how to do it, and I haven't found anything yet with my googling. Does anyone have any thoughts? Thanks.
  8. haku

    'Pretty URLs' how to

    I believe that's a little different. It's possible to change the URL in the browser using javascript, but if the page doesn't exist as a non-javascript solution as well, then it will fail if the user tries to access said URL. In such a case, a backend is still required with URL re-writing.(I'm a JS developer).
  9. haku

    'Pretty URLs' how to

    I guess we have a different perspective on what's basic and what's not. But either way, there we have some solutions. I'm confused by your use of JS though - I thought you meant JavaScript, but there is no JavaScript there.
  10. haku

    'Pretty URLs' how to

    I wouldn't necessarily call it easy. And it doesn't require any javascript. It does require Apache mod_rewrite module (or an equivalent module on whatever server type you are using). Drupal uses the pattern example.com/index.php?q=path/to/some/page which is re-written as example.com/path/to/some/page using the following in the .htacess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^ index.php [L]
  11. haku

    IE8 background image hover bug

    IE8 is still beta.
  12. haku

    Centre Div in Middle of Screen

    Give the div a width, then set the right and left marigns to zero. You will end up with something like this: div { width: 100px; margin: 0 auto; } Of course, that will give ALL your divs the same width and center them, so you will need to specify which div.

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.