SitePoint Sponsor

User Tag List

Results 1 to 25 of 36

Hybrid View

  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Create Up/Down Triangle for Sorting?

    Is there a way to make a Triangle Symbol pointing Up and Down, respectively?

    I want these to use next to a Column Heading for sorting purposes...

    Thanks,


    Debbie

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,902
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    A quick search for "css triangles" and Bingo, over a million results.

    This one was top of the list:


    http://css-tricks.com/snippets/css/css-triangle/


    Quote Originally Posted by DoubleDee View Post
    Is there a way to make a Triangle Symbol pointing Up and Down, respectively?

    I want these to use next to a Column Heading for sorting purposes...

    Thanks,


    Debbie
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    A quick search for "css triangles" and Bingo, over a million results.

    This one was top of the list:


    http://css-tricks.com/snippets/css/css-triangle/
    I already saw that, BUT I asked this question in the HTML Forum because I thought there might be an HTML symbol I could use - like the ampersand...


    Your suggestion sure seems like a lot of code and effort for just a triangle.

    Plus, I need my PHP code to be able to *easily* toggle between an Up Triangle and Down Triangle, and I'm not sure how I'd do that with your CSS suggestion...

    Sincerely,


    Debbie

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,902
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I already saw that, BUT I asked this question in the HTML Forum because I thought there might be an HTML symbol I could use - like the ampersand...


    Your suggestion sure seems like a lot of code and effort for just a triangle.

    Plus, I need my PHP code to be able to *easily* toggle between an Up Triangle and Down Triangle, and I'm not sure how I'd do that with your CSS suggestion...

    Sincerely,


    Debbie
    Here we go:

    PHP Code:
    <?php
      $title
    ='Toggle Up and Down Arrows';
      if( ! isset(
    $_SESSION) ):
        
    session_start();
      endif;
      
    $_SESSION['toggle'] = isset($_SESSION['toggle'] ) ?  $_SESSION['toggle']  : FALSE;
      
    $_SESSION['toggle'] = ! $_SESSION['toggle'] ;
      
    $toggle     $_SESSION['toggle']  ? ''  :  '';
      
    $direction $_SESSION['toggle']  ? 'UP'  :  'DOWN';
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"  lang="en" xml:lang="en">
    <head>
      <title><?=$title;?></title>
      <style type='text/css'>
     .invert {
        -webkit-transform: rotate(90deg);   
        -moz-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
        -o-transform: rotate(90deg);
        transform: rotate(90deg);
        display:inline-block;
    }
    a {text-decoration:none; padding:0.22em 0.42em;}
    a:hover {background-color: pink;}
    </style>
    </head>
    <body>
      <h1>
        <a href="/index.php" title='going <?=$direction;?>'>
           <b class='invert'>
                <?=$toggle ;?>
          </b>        
          <?=$title;?>
        </a>
      </h1>
    </body>
    </html>
    Special Note - Version 001:
    This has been tried, tested and works fine. No doubt it can be optimised if and only if there is sufficient viewers to warrant changes
    Otherwise, next problem please
    Last edited by John_Betong; Nov 10, 2013 at 01:38. Reason: spelling: not my fortay
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    You could use unicode characters ▲ and ▼ if you like. If your pages are served as UTF-8 you can just copy chose characters and insert them. Otherwise, use the character references &#9650; and &#9660; or &#x25B2; and &#x25BC; respectively.

  6. #6
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You could use unicode characters ▲ and ▼ if you like.
    Those are exactly the characters that I was looking for!


    Quote Originally Posted by ralph.m View Post
    If your pages are served as UTF-8 you can just copy chose characters and insert them.
    How would I know that??


    Quote Originally Posted by ralph.m View Post
    Otherwise, use the character references &#9650; and &#9660; or &#x25B2; and &#x25BC; respectively.
    What are all of those characters?

    Sincerely,


    Debbie

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    How would I know that?
    You can check the encoding that your server is sending out in your browser's dev tools. For example, in the Network panel of the Chrome dev tools, click on the page and you'll see your resosponse headers, which will include something like this:

    Code:
    Content-Type:text/html; charset=UTF-8
    What are all of those characters?
    They are the Unicode references for those characters. So, paste &#9650; into a .html file and open it in your browser and you'll see the up arrow:

    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    </head>
    <body>
    
    <p>&#9650;</p>
    			
    </body>
    </html>

  8. #8
    SitePoint Evangelist silver trophybronze trophy
    Join Date
    Jul 2013
    Posts
    406
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)

    A lot of special characters!

    I've just a small presumption that the up/down's are for sorting of a list (as the title of this topic says).
    In that case the down or up will be triggered by an onclick (triggering also the sorting), and is waiting for another click to toggle upside down again. So indeed javascript will be the most efficient way, I think.
    • In case only a hover-state is needed (for a dropdown menu or something like that), css is sufficient for the change.

    @John_Betong: Next problem please? - Can I Use transform - not for IE8 and before ...

    =======
    More special characters
    For who is wondering if there are more of these special characters: yes! There are lists with ten thousands of it (see here or here).
    They cover also all non-Latin alphabets, like Greek, Braille, Chinese, Cyrillian etc. etc.; and mathematic characters, figures, etc.etc.
    For instance:
    The & #931; (without space): Σ
    The & #10283; (without space):
    The & #20001; (without space):
    The & #1049; (without space): Й
    The & #1769; (without space): ۩
    The & #8800; (without space):
    The & #1792; (without space): ܀
    The & #3664; (without space):
    The & #9733; (without space):
    The & #9658; (without space):
    The & #9668; (without space):
    The & #10048; (without space):
    The & #10053; (without space):
    The & #10163; (without space):
    The & #10705; (without space):
    The & #11027; (without space): especially made for the followers of the GR's .

    • With the "font"-size they can be adapted to smaller or bigger.
    • The UTF-8 charset is always safe.
    • Some characters aren't always displayable: they need a special country/language setting of the computer, or special fonts, or maybe something else.

  9. #9
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You can check the encoding that your server is sending out in your browser's dev tools. For example, in the Network panel of the Chrome dev tools, click on the page and you'll see your resosponse headers, which will include something like this:

    Code:
    Content-Type:text/html; charset=UTF-8
    I opened up FireBug on this page, and looked at the HTML, and saw this...
    HTML Code:
    <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    So I guess that means that SitePoint is not being displayed as UTF-8 in my browser??


    I am not understanding how you are supposed to dictate how a page is displayed...

    Do you set this on the Server?

    Or is this something dealing with each webpage?

    Or is this an issue with my browser? (Because I obviously didn't code SitePoint's website!!)


    Right now I'm on my old MacBook and using MAMP.

    But what happens when I upload my code to my VPS?

    This part of the conversation is new to me and not making any sense...

    Sincerely,


    Debbie

  10. #10
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,078
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    If you want to do it dynamically (i.e. without reloading the page), you'll have to use JavaScript to toggle between them.

  11. #11
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pullo View Post
    If you want to do it dynamically (i.e. without reloading the page), you'll have to use JavaScript to toggle between them.
    I thought I established this in the past...

    No JavaScript!!!


    Debbie

  12. #12
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,902
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I thought I established this in the past...

    No JavaScript!!!


    Debbie
    Try this:

    http://www.johns-jokes.com/downloads...edee/index.php

    No JavaScript and simplified CSS so inverse not required.
    Last edited by John_Betong; Nov 10, 2013 at 12:56. Reason: spelling: not my fortay
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  13. #13
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Try this:

    http://www.johns-jokes.com/downloads...edee/index.php

    No JavaScript and simplified CSS so inverse not required.
    Interesting, but not exactly what I wanted.

    Here are my full requirements...

    1.) No JavaScript

    2.) No Cookies (except for Session Cookie)

    3.) No additional "Sort Order" variable in URL (i.e. Must be done behind the scenes using Session variable)

    Why? My "Pretty URL" is long enough as it is!

    4.) Clicking on a Column Heading should sort by that Column and change the Sort Order, however, simply refreshing the page should NOT change the Sort Order

    Why? Image if every time you refreshed your Gmail or Yahoo Mail - to check for new messages - the Sort Order changed?!


    This last requirement makes things trickier!!

    I'm scratching my head now trying to come up with a solution that meets all four requirements above...

    Sincerely,


    Debbie

    P.S. Looks like this thread just went from HTML to PHP!!! (BTW, mods, I was just responding to John's comments...)

  14. #14
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I opened up FireBug on this page, and looked at the HTML, and saw this...
    HTML Code:
    <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    So I guess that means that SitePoint is not being displayed as UTF-8 in my browser??
    It's really the site's server that set the encoding. This is what SP puts out:

    spheaders.png

    It happens to be the same as what's placed in the <head> in the HTML, but if it were different, the server version would win out. (I gather the main reason to have it in the <head> of the document is for when you are viewing pages offline.)

    I am not understanding how you are supposed to dictate how a page is displayed...

    Do you set this on the Server?
    Yes. If you don't like the encoding your server puts out, then you can change it. It's most likely to be UTF-8 these days, though, which is what it should be.

    But what happens when I upload my code to my VPS?
    If your remote server puts out a different encoding, there's a small chance things might change a bit on your site, so it's good to make sure your local server mirrors the settings on the remote server (encoding, PHP versions etc.)

    Looks like this thread just went from HTML to PHP!
    Your original question implied the use of JS or PHP (for sorting etc.), but JS is the standard way to go, whether you like it or not. But obviously it can be done with PHP.

  15. #15
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,902
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Interesting, but not exactly what I wanted.

    Here are my full requirements...
    1.) No JavaScript
    2.) No Cookies (except for Session Cookie)
    3.) No additional "Sort Order" variable in URL (i.e. Must be done behind the scenes using Session variable)
    4.) Clicking on a Column Heading should sort by that Column and change the Sort Order, however, simply refreshing the page should NOT change the Sort Order
    ---
    ---
    ---
    Try this:

    http://www.johns-jokes.com/downloads...edee/index.php

    Please test this new super-dooper version and see if all your requirements are satisfied. Take my word for it, JavaScript is NOT included
    Last edited by John_Betong; Nov 17, 2013 at 21:58. Reason: spelling: not my fortay
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  16. #16
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,078
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I thought I established this in the past...

    No JavaScript!!!
    Oh ok, I didn't realise.
    Just out of interest: why not?

  17. #17
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pullo View Post
    Oh ok, I didn't realise.
    Just out of interest: why not?
    Short answer: It gets on my nerves, and "I" associate it with poor planning and bloated webpages. (Not here to debate that in *this* thread, though!!)




    Debbie

  18. #18
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,078
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Short answer: It gets on my nerves, and "I" associate it with poor planning and bloated webpages.
    Fair enough.
    The bloated pages reputation is also not entirely undeserved.

  19. #19
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,244
    Mentioned
    155 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Sometimes it makes sense to drop things and start a new conversation...

    I appreciate John going out of his way to create a script from scratch to try and help.

    Thanks!

    But when John is asking for others to point out why his script isn't working, and then Francky comes in with his 109 lines of testing of *John's script*, it is a bit much!! (Can we say OCD?)


    And if you really want to see hijacking, go check out this thread... Returning an Array from a Function


    Tangents are fine as long as they are from the Original Poster, or they relate to the Original Post.

    In my opinion, it is NOT okay for someone to come in and ask for help on their code when it isn't their thread. Likewise, it isn't okay to start their own debate when it doesn't pertain to the OP.

    Please tell me how any of Hall Of Famer's rant below relates to my other thread...


    That has absolutely *nothing* to do with what I was originally asking help with!!


    Whatever...


    Debbie
    Debbie,

    In this thread's example, John's code was purely trying to meet what you were trying to achieve, so his contributions and figuring out why it didn't work for you, was definitely relevant.

    In the latter thread, Hall of Famer was continuing the discussion on whether mutli-dimensional arrays were good or bad practice. You got your solution, which is great, but your question generated thoughts at a higher level amongst others (which is going to happen in any thriving community). If you didn't gleam anything useful from the resulting discussion, I'm sorry, next time unsubscribe from the thread once your solution is deemed "found".

    What I can say, is if you ever do go for version 3.0 and OOP, you will want to revisit that discussion. There is a lot of interesting information that each of those guys brings to this community and I highly ask you to really take a step back and ask "What is it that I can learn from them through their discussions that may benefit me in the near or distant future?"

    I'm not trying to be harsh, but the nature of a forum will spawn different directions with or without assistance. That's just the nature of the beast. Yes, if it starts to drift off before a solution is given, or there isn't a clear path to a solution, that's troublesome and we staff will try to remedy those situations. However, neither of these threads presents that case (at least to me they don't).

  20. #20
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,934
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    Debbie,

    In this thread's example, John's code was purely trying to meet what you were trying to achieve, so his contributions and figuring out why it didn't work for you, was definitely relevant.

    In the latter thread, Hall of Famer was continuing the discussion on whether mutli-dimensional arrays were good or bad practice. You got your solution, which is great, but your question generated thoughts at a higher level amongst others (which is going to happen in any thriving community). If you didn't gleam anything useful from the resulting discussion, I'm sorry, next time unsubscribe from the thread once your solution is deemed "found".

    What I can say, is if you ever do go for version 3.0 and OOP, you will want to revisit that discussion. There is a lot of interesting information that each of those guys brings to this community and I highly ask you to really take a step back and ask "What is it that I can learn from them through their discussions that may benefit me in the near or distant future?"
    Probably true, but hopefully you see my side too.


    Quote Originally Posted by cpradio View Post
    I'm not trying to be harsh, but the nature of a forum will spawn different directions with or without assistance. That's just the nature of the beast. Yes, if it starts to drift off before a solution is given, or there isn't a clear path to a solution, that's troublesome and we staff will try to remedy those situations. However, neither of these threads presents that case (at least to me they don't).
    Normally I don't mind, but I just felt both of those threads went a little too far at the end...

    Francky and Hall-of-Famer got way too obsessive whether anyone else sees it that way or not.

    Sincerely,


    Debbie

  21. #21
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Francky and Hall-of-Famer got way too obsessive whether anyone else sees it that way or not.
    While the forums are here to help answer members' questions, there's no rule against showing enthusiasm for a topic and taking it further. Indeed, it's to be encouraged. It makes the forums a truly stimulating and innovative place.

    If you got the answer you needed early on, then great! Unsubscribe and move on if that's all you want. But nobody owns a thread, even if they started it, so let the conversation and exploration follow its natural course, and leave the discussion if you get bored.

  22. #22
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,597
    Mentioned
    984 Post(s)
    Tagged
    14 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    In my opinion, it is NOT okay for someone to come in and ask for help on their code when it isn't their thread.
    In my opinion (and I'm the boss) it's fine provided the OP has had an answer. In this case the rest of the conversation may go some way to helping others.

    The debate can stop now because the thread is losing value.

    If people want to keep discussing the code in question, go for it, otherwise please leave the thread.


Bookmarks

Posting Permissions

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