Domain Manage

Is this possible in PHP (or other languages)

Discussion in 'Scripts and Coding' started by woopwoop, Aug 6, 2010.

Thread Status:
Not open for further replies.
  1. woopwoop United States

    woopwoop Well-Known Member

    Joined:
    Jan 2007
    Posts:
    2,198
    Likes Received:
    33
    At the moment i can retrieve information from a DB and display it nicely in a vertical line of boxes (some boxes with extra information as needed).

    I basically need a version of this with exactly the same information, but instead of a top-down list of divs (boxes), I need them to be displayed going around a circle (starting top centre, going clockwise).

    Does anyone know if this is possible?
    And how easy would it be? Any scripts?

    It's already taken me ages to get the list pulling the appropriate info and displaying in a straight line.

    Thanks for any help/direction.


    Added: The number of divs displayed will be variable depending on what's in the DB. So I can't count on their being a certain number. Therefore the 'circle' would need to re-size in some way?!
     
    Last edited: Aug 6, 2010
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. Skinner

    Skinner Well-Known Member

    Joined:
    Jul 2008
    Posts:
    4,325
    Likes Received:
    81
    You could do it in Javascript or Ajax (JS + PHP), but don't think PHP alone would produce nice of even elegant results.

    You also have the issue of some of your time places being long and over writing others to consider.

    You could look at Tag Cloud code for idea's on position, or clock face code in Javascript like http://www.dynamicdrive.com/dynamicindex6/analog.htm and then strip the code down and latch in PHP and you'd be away pretty quickly.

    I can't think of an easy way tho.
     
  4. woopwoop United States

    woopwoop Well-Known Member

    Joined:
    Jan 2007
    Posts:
    2,198
    Likes Received:
    33
    Cheers Skinner - will take a look at the JS.

    It's pretty tricky to accomplish what I wanted so may have to change my expectations.

    Many thanks.
     
  5. bensd United Kingdom

    bensd Well-Known Member Exclusive Member

    Joined:
    Jan 2007
    Posts:
    4,956
    Likes Received:
    53
    I don't know php so feel free to correct me!

    Could you design a circle in html/css and put php calls in the relevant divs?
     
  6. monaghan United Kingdom

    monaghan Moderator Staff Member

    Joined:
    May 2007
    Posts:
    1,993
    Likes Received:
    45
    Whether you use JS, AJAX, PHP or anything else, the resulting output will need to be DIV's or other tags that you position with CSS (unless you output as a graphic).

    If you use the item number in the ID of the DIV you could use a dynamically created style sheet to position the DIV's according to the number of results returned. If you have a known number of results you could cache a few common style sheets and just reference the desired CSS file.
     
  7. woopwoop United States

    woopwoop Well-Known Member

    Joined:
    Jan 2007
    Posts:
    2,198
    Likes Received:
    33
    This was originally my first thought. But the number of divs is variable based on query results. My final product needed to have divs within the divs that were spread around the circle too - so even more complicated and the circle would definitely need to be produced variably (in size).

    Yeah this is what I was thinking. Just too many variables for me to juggle given that I need the script to function with the results from each query that's sent (which always gives variable results):

    The initial size of circle and position of main divs would depend on:
    1. number of divs
    2. size of each div (based on div content, and if there are 0-2 extra divs inside that div)

    Divs could have a fixed width, but as they are positioned around around the circle, some of the corner positions would be adjusted for the fact they are on the 'left' side of the circle, or on the top or bottom, whereas those divs on the right would have a position where the top left corner of the div could be on the circumference.

    I think I'm best to save this part for a future project. I'm just so happy that I am getting this to work perfectly (so far) in a linear (top-down) design.

    Probably best to quit while I'm ahead!

    Thanks for your help.
     
  8. monaghan United Kingdom

    monaghan Moderator Staff Member

    Joined:
    May 2007
    Posts:
    1,993
    Likes Received:
    45
    If you have a PHP file as the CSS file and pass the number of results returned you can then do the maths for the corner positions and output CSS rather than HTML. Just run the DB query before you start outputting the main HTML so you have the count saving a duplicated SQL query in the CSS PHP.
     
Thread Status:
Not open for further replies.

Share This Page