1. Post #361
    kingzl3y's Avatar
    December 2008
    253 Posts
    I can only assume that <?= echos the content within.
    Thank you for this. my life made easier
    why the fuck didn't I know this 5 years ago?!
    Reply With Quote Edit / Delete Windows 7 Show Events

  2. Post #362
    Gold Member
    Crhem van der B's Avatar
    January 2010
    1,690 Posts
    I still prefer not to use <?= because, as said before, you're not guaranteed that their server will support it if you're making a website for a client.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 3 (list)

  3. Post #363
    Gold Member
    StinkyJoe's Avatar
    June 2006
    2,194 Posts
    I still prefer not to use <?= because, as said before, you're not guaranteed that their server will support it if you're making a website for a client.
    Is that really an issue? When I was doing client work, I had at the very least ftp access to the box (an .htaccess file is usually enough). Worst case scenario, you can just `sed` the directory and replace `<?=` with `<?php echo` and what-not, it's really simple stuff. Might I also add I haven't seen a server with short-tags disabled in quite some time, and that the echo short-tag (<?=) will be enabled by default in 5.4
    Reply With Quote Edit / Delete Linux Portugal Show Events Agree Agree x 3 (list)

  4. Post #364
    Gold Member
    jaybuz's Avatar
    May 2006
    5,516 Posts
    short tags killed my dog
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Funny Funny x 2Dumb Dumb x 1 (list)

  5. Post #365
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    short tags killed my dog
    short tags make my code look nicer

    Edited:

    This:



    looks better than having <?php .. ?> <?php echo ... ?> everywhere
    Reply With Quote Edit / Delete Mac Australia Show Events Agree Agree x 3 (list)

  6. Post #366
    zzlawlzz's Avatar
    July 2010
    1,750 Posts
    short tags killed my dog
    I would never do <? ?> but <?= ?> is so useful.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Optimistic Optimistic x 1Agree Agree x 1 (list)

  7. Post #367
    mcskinsearch
    hacksore's Avatar
    February 2010
    1,054 Posts
    I would never do <? ?> but <?= ?> is so useful.
    If it's your server I see no harm in using short tags. As this has been discussed before it always leads to the arguments of xml using the same open and close tag and that other php environments might not have it enabled.

    I feel this first snippet looks minutely better then the following example.
    <? foreach($array as $k=>$v){ ?>
        Key: <?=$k?> => Val: <?=$v?>
    <? } ?>
    


    <?php foreach($array as $k=>$v){ ?>
        Key: <?php echo $k;?> => Val: <?php echo $v;?>
    <? } ?>
    
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  8. Post #368
    Gold Member
    StinkyJoe's Avatar
    June 2006
    2,194 Posts
    why the fuck didn't I know this 5 years ago?!
    Here's one for yah:

    <p>
        <script language="php">
            echo 'foo';
        </script>
    </p>
    
    Reply With Quote Edit / Delete Linux Portugal Show Events Funny Funny x 5Informative Informative x 1Friendly Friendly x 1Programming King Programming King x 1 (list)

  9. Post #369
    I wasted a dollar on a stupid title.
    nikomo's Avatar
    September 2007
    16,656 Posts
    Right, so I have a problem.

    I have a bunch of parts in a database, and I print the part number, name, model, amount and location into a table.

    Code:
    	<tr>
    		<td bgcolor="<? print $rowbg; ?>"><a href="itemdetail.php?cmd=edit&id=<?=$items[$i]["itemid"]?>"><font color="<? print $link; ?>"><?=$items[$i]["itemno"]?></font></a>&nbsp;<a target="_blank" href="http://fi.eetnordic.com/search.aspx?q=<?=$items[$i]["itemno"]?>"><img src="images/eet.png" height=10 width=25 /></a>&nbsp;<a target="_blank" href="http://www.google.fi/search?q=<?=$items[$i]["itemno"]?>"><img src="images/google.gif" height=10 width=10 /></a></td>
    		<td><a target="_blank" href="http://www.google.fi/search?q=<?=$items[$i]["itemname"]?>"><font color="<? print $link; ?>"><?=$items[$i]["itemname"]?></font></td>
    		<td bgcolor="<? print $rowbg; ?>"><a target="_blank" href="http://www.google.fi/search?q=<?=$items[$i]["konemalli"]?>"><font color="<? print $link; ?>"><?=$items[$i]["konemalli"]?></font></a></td>
    		<td><iframe width="72" height="18" frameBorder="0" src="kpl.php?id=<?=$items[$i]["itemid"]?>"></iframe></td>
    		<td bgcolor="<? print $rowbg; ?>"><font color="<? print $link; ?>">&nbsp;&nbsp;<?=$items[$i]["sijainti"]?>&nbsp;</font></td>
    		<td align="right"><a href="javascript:doDelete(<?=$items[$i]["itemid"]?>)"><img src="/images/redx.gif" height=10 width=10</a></td>
    	</tr>
    Problem is, the amount part. (kpl = amount)
    As you can see from the code above, I use an iframe.
    The iframe connects to the database, fetches the amount from the database. I have 2 images, a plus and a minus sign, when you click on either one, it takes you to another page, does the shit there, and redirects the page back to the one with the amount and plus and minus signs.

    Now, this was a quick solution I made at the time, but I need something better, because of reasons you can probably guess (500 parts, 500 iframes fetching shit from database on page load, how about fuck no).

    The main reason I do that, is because I need to update the amount that is shown, and it's easy with an iframe, you just reload the damn thing, but does anyone have another solution that doesn't suck balls?

    TL;DR: I have a value on a page, I have it in an iframe right now because I need to update the value without reloading the whole page, is there a way to update the value without reloading the whole page, without using an iframe?

    Edited:

    Apparently AJAX would be needed for this.
    Fuck.
    I've never really used JavaScript or XML.

    Edited:

    Apparently jQuery has nice functions which can do what I want. I think I'll do that.

    If I understood it correctly, I need to have the shit inside a div, and then I can somehow reload that div or something.

    Edited:

    Some part of my brain is telling me that won't work and I should just bloody do it as pages and have like 20-40 parts a page.

    Edited:

    On first load, load value from database with PHP, inside div.
    User clicks either value-changing button, load PHP-page in background that does the change, after that happens, another, new page, gets loaded into div, that is basically the iframe thing I'm using now, because I only need the speed upgrade for the situation that main page is loaded.
    Reply With Quote Edit / Delete Windows XP Finland Show Events

  10. Post #370
    lkymky's Avatar
    December 2007
    653 Posts
    I'm kinda looking for a way to do smooth javascript page updates

    Right now because our group is a forever work in progress we have devnights
    pretty much include all of our server owners and people to do any kind of work pertaining to the group's organization.

    We used to have them in our steam group chat but that sorta sucked and always went off topic.

    Last time I made a page with two iframes
    On the left I had an iframe page that would auto refresh every 15 seconds with a list of things we are talking about
    I would edit the HTML and upload the page as we progressed and actually went a bit more smoothly than one might think
    and on the right we have a mibbit IRC chat

    For the left page though it would do really shitty reloads where the page would flash white for a moment load reload and it got really annoying.

    Would there be a better way to do this or perhaps a way to push updates only when they happen?
    I have seen a Minecraft plugin (best example?) called Dynmap, Essentially it live updates a giant Google maps map of a Minecraft server as the server is worked on, you can see players moving around on the map in real time as well as them chatting.
    http://minecraft.almost-there.org:8123

    It updates very smoothly and I would like to know exactly how that works.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  11. Post #371
    Gold Member
    jaybuz's Avatar
    May 2006
    5,516 Posts
    Why don't you use Google Docs, you can chat and live edit all at the same time.
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Agree Agree x 3 (list)

  12. Post #372
    kingzl3y's Avatar
    December 2008
    253 Posts
    Let's say I've got an array of id's - 1, 2, 4, 6, 10 etc - array could vary in size (from 2-3000)
    and let's say that I have a condition that says if id 2 is in that array echo this, and/or if id 10 in that array echo this.
    I know IF/Switch would work, but I wonder if there's a more efficient way of doing it?
    Reply With Quote Edit / Delete Windows 7 Show Events

  13. Post #373
    zzlawlzz's Avatar
    July 2010
    1,750 Posts
    Let's say I've got an array of id's - 1, 2, 4, 6, 10 etc - array could vary in size (from 2-3000)
    and let's say that I have a condition that says if id 2 is in that array echo this, and/or if id 10 in that array echo this.
    I know IF/Switch would work, but I wonder if there's a more efficient way of doing it?
    uh

    <?php
    $arr = array('soemthing');
    $rand_number = mt(1,1000);
    
    $rand_number -=1;
    
    foreach($arr as $number => $echo) {
    if($rand_number == $number) {
    echo $echo;
    }
    } ?>
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  14. Post #374
    mcskinsearch
    hacksore's Avatar
    February 2010
    1,054 Posts
    If you are looking for real time collaborative party programming check out http://www.saros-project.org otherwise just use google docs like jaybuz suggested.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  15. Post #375
    lkymky's Avatar
    December 2007
    653 Posts
    Why don't you use Google Docs, you can chat and live edit all at the same time.
    If you are looking for real time collaborative party programming check out http://www.saros-project.org otherwise just use google docs like jaybuz suggested.

    I did know about google docs, but it really isn't what I want.
    :/ The idea is that it would be an application built and running on the website
    Also we have some anon members who don't want to use their google accounts.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  16. Post #376
    lkymky's Avatar
    December 2007
    653 Posts
    Played with websockets a bit, I can't figure this shit out though.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  17. Post #377
    Meow :3
    Ac!dL3ak's Avatar
    July 2005
    6,045 Posts
    Played with websockets a bit, I can't figure this shit out though.
    what language
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  18. Post #378
    lkymky's Avatar
    December 2007
    653 Posts
    what language
    javascript (oh god the boxes....)
    Reply With Quote Edit / Delete Windows 7 United States Show Events Dumb Dumb x 2 (list)

  19. Post #379
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    javascript (oh god the boxes....)
    rated dumb just for this part
    Reply With Quote Edit / Delete Mac Australia Show Events Agree Agree x 1Winner Winner x 1Programming King Programming King x 1Informative Informative x 1 (list)

  20. Post #380
    Sprite's Avatar
    October 2011
    294 Posts
    How are tags for youtube videos stored?
    In a single row within a table? or ... do they have a pointer to a group of tags


    is it this
    YouTube Videos Table
    title: Carbon Horse
    tags: henry fords car beats horses
    streamData: 101010
    etc:


    or this
    YouTube Videos Table
    title: Carbon Horse
    tagGroupPointer: 9464
    streamData: 101010
    etc:

    Tag Table
    groupID: 9464
    tagWord: henry
    --------------
    groupID: 9464
    tagWord: fords
    --------------
    groupID: 9464
    tagWord: carbon
    --------------
    groupID: 9464
    tagWord: horse
    --------------

    Edited:

    I ask "what does youtube do?" because they are most likely doing it the best way.
    So what is the best way?


    It looks like the tagtable...
    hrm. yeah. looks legit

    Edited:

    What kind of int does Twitter use when they store tweets in a table?
    Each tweet has an ID....
    but ... ...
    not even BIG INT covers "163221013486772224"
    Reply With Quote Edit / Delete Windows 7 United States Show Events Dumb Dumb x 1 (list)

  21. Post #381
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    163221013486772224 fits in 64 bits...
    Reply With Quote Edit / Delete Mac Australia Show Events Programming King Programming King x 1 (list)

  22. Post #382
    Sprite's Avatar
    October 2011
    294 Posts
    yeah. I should have actually done the math before I trusted my hyporbole
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  23. Post #383
    Gold Member
    marcin1337's Avatar
    May 2006
    876 Posts
    So in javascript I have a form
    Code:
    	var iWzrost = document.forms['BMI'].Wzrost.value;
    I get a value from it , the user is suposed to input in a number like "1.5434", but this is a european website so users will input it like so "1,54535" ,how do I fix or convert that to a number?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  24. Post #384
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    parseFloat(document.forms['BMI'].Wzrost.value.replace(",","."))

    also don't use hungarian notation
    Reply With Quote Edit / Delete Mac Australia Show Events Zing Zing x 2 (list)

  25. Post #385
    Gold Member
    marcin1337's Avatar
    May 2006
    876 Posts
    parseFloat(document.forms['BMI'].Wzrost.value.replace(",","."))

    also don't use hungarian notation
    Can I ask why is it not advisable to use it?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  26. Post #386
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Can I ask why is it not advisable to use it?
    http://www.joelonsoftware.com/articles/Wrong.html
    Reply With Quote Edit / Delete Mac Australia Show Events Informative Informative x 1 (list)

  27. Post #387
    Meow :3
    Ac!dL3ak's Avatar
    July 2005
    6,045 Posts
    javascript (oh god the boxes....)
    no shit sherlock

    i meant the server
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  28. Post #388
    wutanggrenad's Avatar
    September 2007
    1,197 Posts
    I've come to the conclusion that I'm pretty much color retarded. Either that or I just never like the colors I choose.

    I use stuff like Adobe Kuler but was wondering what you guys use?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  29. Post #389
    Gold Member
    jaybuz's Avatar
    May 2006
    5,516 Posts
    - snip, wrong thread -
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  30. Post #390

    July 2011
    580 Posts
    Am I allowed to post a listing of my domain for sale?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 3 (list)

  31. Post #391
    Gold Member
    Ardosos's Avatar
    July 2009
    7,033 Posts
    -snip-
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  32. Post #392
    Should I need users that register on my site to agree with a license agreement? If yes, why exactly?
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events Disagree Disagree x 1 (list)

  33. Post #393
    zhed+redball.jpg
    xmariusx's Avatar
    May 2010
    1,367 Posts
    Why won't this work to make a sticky footer?

    Code:
    <body>
      <div id="content">
        Content of the site
      </div>
      <div id="footer">
        (c)Owner
      </div>
    </body>
    Code:
    #content {
    height:100%;
    }
    #footer {
    height:100px;
    margin-top:-100px;
    }
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  34. Post #394
    Why won't this work to make a sticky footer?

    <body>
    <div id="content">
    Content of the site
    </div>
    <div id="footer">
    (c)Owner
    </div>
    </body>

    #content {
    height:100%;
    }
    #footer {
    height:100px;
    margin-top:-100px;
    }
    Don't you mean something like
    Code:
    position: fixed;
    bottom: 0;
    ?

    PS. Use [ CODE ] tags
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events

  35. Post #395
    zhed+redball.jpg
    xmariusx's Avatar
    May 2010
    1,367 Posts
    Don't you mean something like
    Code:
    position: fixed;
    bottom: 0;
    ?


    PS. Use [ CODE ] tags
    No, I don't want it to be at the bottom of the screen all the time. Only when You have scrolled to the bottom of the site
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  36. Post #396
    RAPISTS ARE OPPRESSED
    mobrockers2's Avatar
    April 2011
    12,403 Posts
    Why won't this work to make a sticky footer?

    Code:
    <body>
      <div id="content">
        Content of the site
      </div>
      <div id="footer">
        (c)Owner
      </div>
    </body>
    Code:
    #content {
    height:100%;
    }
    #footer {
    height:100px;
    margin-top:-100px;
    }
    http://ryanfait.com/sticky-footer/
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  37. Post #397
    zhed+redball.jpg
    xmariusx's Avatar
    May 2010
    1,367 Posts
    That doesn't answer my question?
    Reply With Quote Edit / Delete Windows 7 Norway Show Events Disagree Disagree x 1 (list)

  38. Post #398
    SirCrest is my life, so is yours.
    Goz3rr's Avatar
    October 2009
    7,271 Posts
    What would be the best webhost? I also need 2 domains
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  39. Post #399
    zzlawlzz's Avatar
    July 2010
    1,750 Posts
    What would be the best webhost? I also need 2 domains
    what are you planning on using it for? How much traffic are you expecting?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  40. Post #400
    I paid $2 for this
    Miljaker's Avatar
    October 2010
    780 Posts
    No, I don't want it to be at the bottom of the screen all the time. Only when You have scrolled to the bottom of the site
    Code:
     
    position:absolute;
    bottom:0;
    ?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events