Jump to content

kvnmck18

Members
  • Posts

    365
  • Joined

  • Last visited

Posts posted by kvnmck18

  1. 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?

  2. 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...

  3. 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!

  4. 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.

  5. 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)

  6. 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.

  7. 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~

  8. 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?

  9. As for updates and deletions, I haven't even touched my bag today, so I don't have anything new, but I already have the basic idea. Simply copy each element shallowly(xsl:copy, not xsl:copy-of), exept the one matching certain criterias.
    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
  10. 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.

  11. 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?

  12. 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>

  13. 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!!!!

  14. 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?...

  15. 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>";?>

×
×
  • Create New...