Jump to content

kvnmck18

Members
  • Posts

    365
  • Joined

  • Last visited

Everything posted by kvnmck18

  1. Forget this...I had a typo. It works. (I'm dumb)
  2. I'm using this: <xsl:template match="channel"> <div id="show_image_holder"> <div id="show_thumb_holder"> <center> <table cellpadding="0" cellspacing="2"> <xsl:for-each select="item/image"> <td class="image_td"> <a href="#"> <img src="{url}" title="{description}" class="show_thumb_image" /> </a> </td> <xsl:if test="position() mod 8 = 0"> <tr /> </xsl:if> </xsl:for-each> </table> </center> </div> </div></xsl:template> There are still problems...like repeats, it's weird.Why does this not work properly?
  3. I'm trying something like this: <xsl:param name="columns" select="10" /><xsl:template match="channel"> <div id="show_image_holder"> <center> <img src="images/shows/DSC04805.JPG" class="show_large_image" /><br /> </center> <div id="show_thumb_holder"> <table cellpadding="0" cellspacing="0"> <xsl:apply-templates select="item/image[(position() mod $columns) = 1]" /> </table> </div> </div></xsl:template><xsl:template match="item/image"> <tr> <xsl:for-each select=". | following-sibling::product[position() < $columns]"> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> </xsl:for-each> </tr></xsl:template> It's still not working...
  4. I'm trying to make a table with 9 columns and "x" amount of rows. With what I have below this repeats one image repeat 9 times per row, I want the first then the next position then next.I tried using a this key: <xsl:key name="image" match="item/image" use="url"/>and for the "for-each" I used:<xsl:for-each select="item/image[count(. | key('image', url)[1]) = 1]"> (this did not work)Here's my XSLT: <xsl:template match="channel"><div id="show_image_holder"><div id="show_thumb_holder"><table cellpadding="0" cellspacing="0"><xsl:for-each select="item/image"> <tr> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> <td class="image_td"> <img src="{url}" title="{description}" class="show_thumb_image" /> </td> </tr></xsl:for-each></table></div></div></xsl:template> Hope someone can help~Thanks!
  5. it's currently: overflow:auto;background-image:url('images/main_menu_back_in.png');background-repeat:repeat-y;background-position:top right I want it in the EXACT position I have it now...but...just get it "fixed" ...but when I do it moves the image in a wrong position....and I was wrong in Mozilla it's doing the same too...but not on all the thing I've tried, with this it's the same problem.
  6. When you use a code like the following: background-image:url('images/image.png');background-repeat:no-repeat;background-position:top left;background-attachment:fixed ...The image is not placed properly...but in all other browsers it's perfect (including IE 6)...anyone else run into this yet?When I remove the "fixed" it's in the right place, but I also want it fixed.(this is in a div)
  7. kvnmck18

    New to PHP

    I sugguest using XML along with XSL and PHP.You can do the same using SQL or whatever.
  8. I have this so far as a starter this will work for making a thumbail 50% smaller: <?php$filename = 'image.jpg';$percent = 0.5;header('Content-type: image/jpeg');list($width, $height) = getimagesize($filename);$newwidth = $width * $percent;$newheight = $height * $percent;$thumb = imagecreatetruecolor($newwidth, $newheight);$source = imagecreatefromjpeg($filename);imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);imagejpeg($thumb);?> This helps in sorts but instead of a percent I want it to be like "$height < 50px"...to set a max height then get the ratio of what the difference is and make the width be in proportion.Aren't they similar? Send it... let me try it.
  9. I know this is a "security risk" of sorts... but any ideas on making a PHP image uploader (for PHP 4); when image is uploaded it limits the image to a max height and width (while still keeping it in proportion to it's original dimensions) and also created a second image that is the same image just scalled down more to a smaller max height & width dimension (to be used as a thumbnail).I'm currently look at imagecreatefrompng() and imagecreatefromjpg() funtions, along with php upload functions, imagecopyresized().Sugguestions? Any previous codes floating around that I can work with?Thanks~
  10. kvnmck18

    PHP and XML

    Err that PHP5...you know it, boen_robot
  11. boen_robot.... long time no talk...Hey...post that php5 code you were working on the other day... I think I have an idea, but I forgot what you had. ....or did you get that to work? (The php5 add, delete, edit form...)
  12. Hmmm.... what was I thinking when I first posted this. Use XSLT.... with your XML.I could explain more if you post an example of your XML... and get you rollin' with it.
  13. When you do do the php5...I can try to get the php4 to work the same.
  14. Yeha, I have too that's what I'm confused about...maybe it's because I'm using htmlchars(). I don't see why that would limit the output.It could be because it's POST location is in an attribute of an XML but that shouldn't matter either.It might of been my server was being slow the other night...I need to try this out again and see if it continues...if it does I'll post the code.I guess from this the only question is: Does htmlchars limit limit submission of data?
  15. Post any ideas? I want to know what you are thinking. I'm thinking have a select field in the form that has three choices: Add, Delete, Edit. These "Add, Delete, Edit" passed as params that call different templates in the XSL, one for Add, one for Delete, one for Edit. If you want to delete or add you have to call the element by it's title or assigned id or whatever. But that's just the starting of this. hmmmmmmmmmm
  16. It's only a paragraph long. Example...a form that when filled out is used on another page as a POST and one of the input fields is a textarea...it won't process it, it just load a blank page...doesn't finish processing.
  17. In php why won't it process a GET or POST if a value is too long? What is the letter/word limit? How can you fix this?
  18. This isn't working 100% now... or maybe it's how it was all the time. you need to start the xml with:<?xml version="1.0" encoding="UTF-8"?><name><img cat="and I quote" id="gfh" two="hfgh" /></name>...to get this to work.boen_robot any ideas on updates and deletions?
  19. thanks to the help of boen_robot... this is solved! boen_robot is a living legend THe next addition to this will be to add a "delete" in the form and a "Edit"Here's all the code:Process.php: <?php$input = '<img cat="' . htmlspecialchars($_POST['cat'], ENT_QUOTES) . '" id="'. htmlspecialchars($_POST['id'], ENT_QUOTES) . '" />';$args = array('input' => $input);$xmlfile = "xml.xml";$xslfile = "xsl.xsl";$engine = xslt_create();$output = xslt_process($engine, $xmlfile, $xslfile, NULL, NULL, $args);unlink($xmlfile);$handle = fopen($xmlfile, "w+");fwrite($handle, $output);fclose($handle);xslt_free($engine);print "New Content Added Successfully";print "<br />";print "<a href=\"index.html\" title=\"return\">Return</a>";?> xsl.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="input"/><xsl:template match="/*" ><xsl:element name="{name()}"><xsl:copy-of select="*"/><xsl:value-of select="$input" disable-output-escaping="yes"/></xsl:element></xsl:template></xsl:stylesheet> xml output is equal to: <?xml version="1.0" encoding="UTF-8"?><name><img cat="and I quote" id=""two"" /></name> index.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><form action="process.php" method="post"><input name="cat" type="text"/><br /><input name="id" type="text"/><br /><input type="submit" /></form></body></html>
  20. I'm not sure if that will work...as in adding new elements to an xml.Also if it does work...the w+ will convert the &amp's (and ect) back to the unconverted form of &.Have you tried this? I hope I'm mistaken.
  21. I think the solution might be str_replace. But I can't get it to workI just need the &, ", '$change = array("&", '"', "'");$changed = array("&", "'", """);$changing = str_replace($change,$changed,$write_string); ...that's wrong...enven if it worked it work also convert the quotes after the "=s" so it would result in that error. jfklsdjflkj!!!!
  22. Wait I'm thinking.... what if....$fp = fopen("xml.xml", "w+"); was $fp = fopen("xml.xml", "r+"); and the xml.xml was called in another xml (called realxml.xml).xml.xml contains: <arg cat="One" subj=" asdfsd" other="sf & sd" /><arg cat="Two" subj="sdaf asdfsd" other="Isdfsdf sdsdf sf sd" /><arg cat="Three" subj="sddfsr4d" other="Isgfsdt56sf sd" /> realxml.xml contains: <whatever>(call xml.xml)</whatever> So give you: <whatever><arg cat="One" subj=" asdfsd" other="sf & sd" /><arg cat="Two" subj="sdaf asdfsd" other="Isdfsdf sdsdf sf sd" /><arg cat="Three" subj="sddfsr4d" other="Isgfsdt56sf sd" /></whatever> Is that even possible? Call another XML in one xml?...
  23. What if I just... added htmlspecialchars() to the actual form (Form.php) to change the &, ", ', ?,<,>...but then I have the problem once I add another the previous characters go back to be invalid (An error occurred: XML parser error 4: not well-formed)....because the "w+" in the php handeling, rewriting the whole xml and not reading & as & but making & = &...Resulting in the error. And if I add the htmlspecialchars to the php it would make the whole XML in the specialcharsERR there must be a solutionI think if I make the args process as specialchar it might work but that might do the same thing as mentioned above (once another one added it goes back to the "&'s and ects")Just the "$arg[cat]" "$arg[subj]" "$arg[other]" need the htmlspecialchar().... so whenever cat is equal to a value, use htmlspecialchar... same when dealing with subj="something" other="something".(again) Form.php: <?$whatever = Array();function start_element($parser, $name, $attrs){ global $whatever; if($name == "arg"){ array_push($whatever, $attrs); }}function end_element ($parser, $name){}$whateverXML_string = file_get_contents("xml.xml");$parser = xml_parser_create();xml_set_element_handler($parser, "start_element", "end_element");xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);xml_parse($parser, $whateverXML_string) or die("Error parsing XML document.");print "<br />";if($_POST['action'] == "ins"){ array_push($whatever, Array( "cat" => $_POST['cat'], "subj" => $_POST['subj'], "other" => $_POST['other'], $whatever_final = $whatever;}else if($_POST['action'] == "del"){ $whatever_final = Array(); foreach($whatever as $arg){ if($arg['id'] != $_POST['id']){ array_push($whatever_final, $arg); } }}$write_string = "<whatever>";foreach($whatever_final as $arg){ $write_string .= "<arg cat=\"$arg[cat]\" subj=\"$arg[subj]\" other=\"$arg[other]\" />";}$write_string .= "</whatever>";$fp = fopen("xml.xml", "w+");fwrite($fp, $write_string) or die("Error writing to file");fclose($fp);print "You did it, way to go!!!";print "<br />";print "<a href=\"form.php\" title=\"return\">Return</a>";?>
  24. Sorry...what? You lost me, I don't follow what you are saying.and... how does that do:& = &< = <> = >' = ' " = " ??????????????????????? ...errr! It changed my characters for them~
  25. I still can't figure this out. I think I will start crying until it is solved....or at least have a headache.
×
×
  • Create New...