WTF ... IS WTF!?
We are a collective of people who believe in freedom of speech, the rights of individuals, and free pancakes! We share our lives, struggles, frustrations, successes, joys, and prescribe to our own special brand of humor and insanity. If you are looking for a great place to hang out, make new friends, find new nemeses, and just be yourself, WTF.com is your new home.

Two XML questions

Fire_ze_Missles

Martha Fuckin' Stewart
1,622
5
38
#1
I am dabbling in XML and I have run into a couple questions.

At home, on my machine, my xml file shows as it should. However, at work, my file shows only text. Does anyone why this is? I am using Firefox on both computers. I uploaded the file to my server and it works fine. It just will not render locally. :question:

::edit:: I figured out the problem above. I forgot I had changed around my xsl file and didn't realize it.

Secondly, I have a site, in which I developed with standard html. And there are several areas in which I want to "embed" the xml into the html design. How do I go about doing this? Do I need to rewrite for XHTML compliance? I am currently validated for HTML 4.01.

Any Help is much appreciated. :thumbsup:
 

Jung

???
Premium
13,993
1,401
487
#2
Edit: Nevemind then, glad you figured it out. :thumbsup:



The easiest way would probably be using XHTML. I say because it would be a lot easier to call the XML application that way, it's also more semantically correct. Then again, it may not actually be easier, depending on the amount of code you'd need to convert.
 

Fire_ze_Missles

Martha Fuckin' Stewart
1,622
5
38
#3
Conversion to xhtml went smooth except for the fact that my javascripts aren't being recognized, well, I take that back. Some of the functions work, some don't. Weird.
::edit:: Figured out the Jscript thing, gimp-ass xhtml. :rolleyes:
Anyhow, can I simply copy/paste my xml document into my xhtml doc and link the xsl stylesheet in?

Any ideas for either are much appreaciated. :thumbsup:
 

Jung

???
Premium
13,993
1,401
487
#4
Fire_ze_Missles said:
Conversion to xhtml went smooth except for the fact that my javascripts aren't being recognized, well, I take that back. Some of the functions work, some don't. Weird.
Make sure you're using this if you're doing inline scripts.
PHP:
<script type="text/javascript" language="javascript">
<!--
    script here
//-->
</script>
I usually link them though, it keeps the code cleaner.
PHP:
<script src="file.js"></script>
Anyhow, can I simply copy/paste my xml document into my xhtml doc and link the xsl stylesheet in?
Sure, first make sure you're XSL declaration is correct.
PHP:
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Then use these as your open and closing tags.
PHP:
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>




At least I think that's what you meant?
 

Fire_ze_Missles

Martha Fuckin' Stewart
1,622
5
38
#5
I have a section like this:

Code:
<div id='contThree' style='width:240px; height:363px; border: 3px #fbc84f solid; 
       background-color:#b0c4de; overflow: auto;' align="center">
   <div id='newsModule' style='width:240px;' align="left">
   </div>	
</div>
And in the div of newsModule I want this sample xml placed in it:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="news.xsl"?>

<news>
 <module>
  <date>
   <month>2</month>
   <day>8</day>
   <year>2005</year>
  </date>
  <main>
   <title>Test Suite</title>
   <para>
    <data>Ipslum ie do rama tu es la isoleces</data>
   </para>
  </main>
  <closing>
   <poster>Greg</poster>
   <time>2:39pm</time>
  </closing>
 </module>
</news>
I have an xsl stylesheet as well; and I can post some of the code for that as well, but I don't think it is relevant right now.
The question is; can I just copy the xml into the newsModule without doing anything special?

My code is valid XHTML Transitional.
 

Jung

???
Premium
13,993
1,401
487
#6
This should work fine. I

Also, I haven't forgot about the gallery source. I still need to add those comments though. I'll PM you with a zip when I'm done.

PHP:
<div id='contThree' style='width:240px; height:363px; border: 3px #fbc84f solid; 
       background-color:#b0c4de; overflow: auto;' align="center">
   <div id='newsModule' style='width:240px;' align="left">
   <?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="news.xsl"?>
<news>
 <module>
  <date>
   <month>2</month>
   <day>8</day>
   <year>2005</year>
  </date>
  <main>
   <title>Test Suite</title>
   <para>
    <data>Ipslum ie do rama tu es la isoleces</data>
   </para>
  </main>
  <closing>
   <poster>Greg</poster>
   <time>2:39pm</time>
  </closing>
 </module>
</news>
   </div>	
</div>
 

Jung

???
Premium
13,993
1,401
487
#7
FAO: FireZe

I updated the gallery to support png and gif, my gif support was broken before. :rolleyes: I didn't add bmp support, but you can add that easy enough if you use this as a template.


In index.php add the following lines under the code for jpgs. (vBulletin is retarded, indent the first if statement properly.)
Code:
if((substr(strtolower($f),-3) == 'png') || (substr(strtolower($f),-3) == 'png'))
    {
        $imageinfo = getimagesize($_images_dir_.$f);
        $width = $imageinfo[0];
        $height = $imageinfo[1];
        $size = round(filesize($_images_dir_.$f)/1024,1).' KB';
        $noimage++;
            $images[] = array('filename' => $f, 'width' => $width, 'height' => $height, 'size' => $size);
        array_multisort($images, $_sort_, SORT_REGULAR);
    }
    if((substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'gif'))
    {
        $imageinfo = getimagesize($_images_dir_.$f);
        $width = $imageinfo[0];
        $height = $imageinfo[1];
        $size = round(filesize($_images_dir_.$f)/1024,1).' KB';
        $noimage++;
            $images[] = array('filename' => $f, 'width' => $width, 'height' => $height, 'size' => $size);
        array_multisort($images, $_sort_, SORT_REGULAR);
    }
In picture.php uncomment the block for pngs.
Code:
if(substr($_GET[img],-3) == "png")
  {
   header("Content-type: image/png");
    $dst_img=ImageCreate($new_w,$new_h);
    $src_img=ImageCreateFromPng($_image_);  
    ImagePaletteCopy($dst_img,$src_img);
    ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
    $img = Imagegif($dst_img);
  }