Jump to content

AV1611

Members
  • Posts

    997
  • Joined

  • Last visited

Everything posted by AV1611

  1. AV1611

    JS Help

    I DO NOT know JS but I do know PHP That being said... I have the script in the head of a page: <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=400,height=200,scrollbars=yes'); return false; } //--> </SCRIPT> I have this in the body: <BODY onLoad="popup('autopopup.html', 'ad')"> It works fine except I need to change it so if the main page (index.html) is reloaded, the popup is not reloaded, but rather it doesn't nothing. My PHP Solution would be to set a session in the popup and have a clause on the <body> tag to enable/disable the popup on reload, but it seems there should be a slick JS way to do it. Suggestions?
  2. I was not able to figure out where to put the braces when I tried to loop it but you BREAK statement worked great... never did that before Thanks!
  3. Here is a snippet I use to display an xml feed on another page. I need to know how to make it only show the first 5 items in the feed rather than all of them: <?php require_once "XML/RSS.php"; $file=file_get_contents('http://mypage.com/wordpress/?feed=rss2'); $r=& new XML_RSS($file); $r->parse(); //echo '<pre>'; //print_r($r); //echo '</pre>'; $i=0; foreach($r->getItems() as $entry) { echo '<div class="infoblock">'; echo "<p>"; echo '<a style="font-size: 130%;" href="'; echo $entry['link']; echo '">'; echo $entry['title']; echo "</a></p>"; $line=$entry['content:encoded']; $line=str_replace('/>','>',$line); $line=str_replace('</p>','</p><p> </p>',$line); echo $line; echo "<p style='text-align: center;'><a href='".$entry['comments']."'>Click here for comments or to leave a reply</a></p><p> </p>"; echo "</div>\n"; } ?> I know this is where the items come from foreach($r->getItems() as $entry) but I don't know how to make the foreach also do while $i < 5 or whatever... Thanks in advance.
  4. First thank you so very much. This is what I needed. Second... It doesn't work No matter what I check, the value is "0" in the box. I'm not sure what info I need to give you more?
  5. I know nothing about JS but am pretty PHP savy. I almost always can do whatever I want in PHP but in this case I need some help with a one time JS that I will use for 10 days then prolly never need again. I am making a signup form for a charity event. All I need is to make a column of things and a subtotal. I will use checkbox's for the items item 1 - $10 item 2 - $10 item 3 - $50 then at the bottom I need a input text that is updated to whatever the total of all the items with checks then they hit submit and that's it. I can handle the rest. I just have no idea how to make the value of the text input reflect the total of the items checked. Thanks for any help.
  6. I was trying to figure how to do what Zhadus suggested but couldn't figure it out, but Thorpe, your answer is much better in this case, As always, you are my hero Thorpe!
  7. I've only done a little with GD, but I can say that I think PNG is opened as indexed, so the transparency won't work. without doing other stuff... Try: <?php function LoadPng($imgname); { $im=@imagecreatefrompng($imgname); return $im; } header("Content-Type: image/png"); $img=LoadPng("sigs/blue_proto.png"); imagepng($img); ?>
  8. How can I count the number of .jpg files (exact extension, not .jpeg for example) in the current directory (i.e. the directory in which the php script is located)? Thanks.
  9. AV1611

    100% height

    I gave up. Look at the link now, it's working, but I got the answer from another site.
  10. AV1611

    100% height

    True, but then that creates another problem. This page doesn't fill 100% if you remove the content from it. (I removed all teh test lines and now the page is "short"
  11. AV1611

    100% height

    Can someone explain to me why this main div isn't dynamically expanding with content? I have html, body, & div set to height: 100% and tried min-height: 100% on the div. All the css is in the index.html file. Thanks. http://design.blmservices.com/nwts/index.html
  12. I looked for hours in the php online manual, but I didn't know what it was called so didn't know how to find it. I had a GD script that was failing and that line was giving a Notice: but I didn't know why. Thanks.
  13. $user='username'; $hostmachine='localhost'; $password='password'; $database='dbname'; mysql_connect($hostmachine,$user,$password); mysql_select_db($database); $query = "SELECT * FROM table WHERE field like 'whatever'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ do something here with $row[0],$row[1], etc... } This will loop through each result line.
  14. I do this type of thing all the time index.php?page=1 index.php?page=2 etc... <?php if(isset($_REQUEST['page']) && $_REQUEST['page'] == '1'){ Put the first page here } elseif($_REQUEST['page'] == '2'){ Put the second page here } etc... Now you have one script that loads each page for each query. You can also put that just in the "content" <div> of the page, so the rest stays static.
  15. I have this statement in a script: $value += $data[$i]; what does += mean? Thanks
  16. LOL... I was gonna say that but I didn't wanna lose focus on the actual question =P
  17. Ah, my server has error's reporting but not notices prolly ... I never saw those errors before. Thanks.
  18. AFAIK Apache sets a thread for each session so I would say no
  19. ... and the image that shows is always: ./style/header2.jpg if ($h = 10) $img = './style/header1.jpg'; will always be TRUE because $h = 10 is setting a variable. You want: if ($h == 10) $img = './style/header1.jpg'; which is a comparison.
  20. I have a nice pie chart script but it doesn't seem to be working correctly on some servers. The script is below. I have 4 Servers, 3 are Fedora 10 with LAMP and GD enabled, and 1 is Mint Linux (Ubuntu/Debian) with LAMP and GD. The Script works on the Mint Linux setup at http://64.234.49.7/new.php The same Script is at http://69.59.125.225/stripe/new.php but doesn't work. I get no errors, and GD does work both on other scripts and the output to screen isn't text, it's a JPEG image... I'm very confused and can't imagine what to look at to figure out the issue. Like I said, GD does work on other scripts I use on the Fedora server. Here is the script:
  21. Um... without some code, I got no idea what you want...
  22. Thanks, I found that but it didn't make sense until you just did it I also found this but it's more complex than I need in this case, but is a better answer maybe in some cases: $numArgs = func_num_args(); Thanks.
  23. I have a function I wrote, but to make the point, here's a simple example. Let's say I do function myfunc($a,$b){ echo $a; echo $b; } What I want to do is make $b optional, and if it's not set, for the function to assume a predefined string. In this case it's a percentage that I use in some css later, so I want the string to default to 100 if $b is not used i.e. myfunc($a) but $b to pass if it's myfunc($a,$b) How do I do that? Thanks.
  24. What is the proper way to host a FLV file? I don't care about hot links, etc. I want it to "stream" Apache2 on Fedora 10 Thanks
×
×
  • Create New...

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.