Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    A rather tricky (to me) problem

    On another website to do with computer hardware (it's a forum too), we have a news section. Now, most people use quote tags bug I metro'd my post.

    See: http://www.overclock.net/t/1288830/t...-to-make-money

    People say it looks good and is cool.

    So, I decided to build a quick webpage to "metro" their posts.

    I have it live here:

    http://briandempsey.org.uk/Newstool/index.php

    One problem. I have 5 sources listed. However, even if the person doesn't want 5 sources it forces them too as it generates the HTML just without the internal link.

    Is there a way I could use javascript to check if their is content in the input, and if not, skip it or "hide" it?

    Thanks

    Mandex

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.

    I have no idea what you mean by "metro" their posts - but I doubt if Javascript can help you here due to the Same Origin Policy. Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.

    It is your responsibility to die() if necessary….. - PHP Manual

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.

    I have no idea what you mean by "metro" their posts - but I doubt if Javascript can help you here due to the Same Origin Policy. Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.

    It is your responsibility to die() if necessary….. - PHP Manual
    Thanks. See: http://www.overclock.net/t/1288830/t...-to-make-money for the "metro'd" post. I just put the content in tiles, that's all.

    I don't know why you posted about SOP? As the users input all the data on my site, wouldn't that give me access to it?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    Quote Originally Posted by Mandex View Post
    Thanks. See: http://www.overclock.net/t/1288830/t...-to-make-money for the "metro'd" post. I just put the content in tiles, that's all.

    I don't know why you posted about SOP? As the users input all the data on my site, wouldn't that give me access to it?
    Not with Javascript which cannot communicate with the server. As I see it you need server-side coding for this.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    New Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ok, so could I use PHP to accomplish it then? I just need to check for content, and then hide it if there is none.

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    Quote Originally Posted by Mandex View Post
    Ok, so could I use PHP to accomplish it then? I just need to check for content, and then hide it if there is none.
    Post your question in the PHP forum (with a more descriptive title, please).

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •