Jump to content

acondiff

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

acondiff's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Right now, when writing a new post the slug reflects the title. I have three custom fields: number, first_name, and last_name. I want the slug to look like this: /03-John-Smith/ I am using a custom post type that does not support the title field, only this custom metabox. So I need it to do this for the permalink to be unique. How can I do this? Thanks.
  2. thank you so much for your help. its working great now. =)
  3. im sorry i have it wrong... $about = $_POST['about']; $xmlLoc = $_SERVER['DOCUMENT_ROOT'] . '/new/wp-content/themes/default/flash/xml/about.xml'; $doc = new DOMDocument(); $doc->formatOutput = true; $r = $doc->createElement( "html" ); $doc->appendChild( $r ); $a1 = $doc->createTextNode( $about ); $cdata = $dom->createCDATASection( $about ); $r->appendChild($cdata); $doc->save( $xmlLoc ); Fatal error: Call to a member function createCDATASection() on a non-object
  4. It's giving me "<" instead of "<". And its not wrapping it all in CDATA. How can I do that?
  5. ok a have it echoing in a textbox. now i need to have it save to the same xml file once the user makes the changes. I've got this: <?php if (array_key_exists('_submit_check', $_POST)) { $about = $_POST['about']; $xmlLoc = $_SERVER['DOCUMENT_ROOT'] . '/new/wp-content/themes/default/flash/xml/about.xml'; $doc = new DOMDocument(); $doc->formatOutput = true; $r = $doc->createElement( "html" ); $doc->appendChild( $r ); $a1 = appendChild($doc->createTextNode( $about ) ); $r->appendChild( $a1 ); $doc->save( $xmlLoc ); } ?> But it doesn't work. It gives me the following error: Fatal error: Call to undefined function appendChild() in /[serverpath]/functions.php on line 846 ($a1 = app...) I need it saving in this format: <node> <html> [node value goes here] </html> </node> Thanks.
  6. So I have an xml file that has a single node and I wanted to echo the node value. The XML looks like this: <node> <html> <![CDATA[ <p>This is my <b>HTML</b> text.</p> ]]> </html> </node> Ive tried the following but it does not work. $doc = new DOMDocument(); $doc->load( html.xml' ); $html_xml = $doc->getElementsByTagName( "html" ); $html_txt = $html_xml->nodeValue; echo $html_txt; How can I echo out this data? Thanks?
  7. UPDATE: This code: <?php $dir = TEMPLATEPATH . "/flash/music/"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($fileread = readdir($dh)) !== false) { if($fileread == "." || $fileread == ".." || $fileread == "index.php" ) continue; $fullpath = $dir . $fileread; $musicfile = fopen($fullpath, 'r'); fseek($musicfile, -128, SEEK_END); $tag = fread($musicfile, 3); if($tag == "TAG") { $data["song"] = trim(fread($musicfile, 30)); $data["artist"] = trim(fread($musicfile, 30)); $data["album"] = trim(fread($musicfile, 30)); } else { echo "MP3 file does not have any ID3 tag!"; } fclose($musicfile); while(list($key, $value) = each($data)) { print("$key: $value<br>\r\n"); } } } } ?> Returns this: MP3 file does not have any ID3 tag! Warning: Variable passed to each() is not an array or object in /hermes/bosweb/web070/b703/ipw.condiffp/public_html/new/wp-content/themes/default/functions.php on line 1053 song: X&Y artist: Coldplay album: X&Y So oddly enough, it is only retrieving the second songs id3 data.
  8. when I add this code: echo "$musicfile<br>"; it echos out this: "Resource id #98" Shouldn't that be a filename?
  9. Thank you so much. That got rid of one error. It is still saying that it doesn't have an ID3 tag when I know it does. filename: /[my_server_path]/public_html/new/wp-content/themes/default/flash/music/09 Low.mp3 MP3 file does not have any ID3 tag! I did try changing this if($tag == "TAG") to this if($tag ) but that didn't work either. its not running through that if statement. somethings probably wrong with $tag. I actually ran this very similar script on one file and it did work, I am just trying to apply it to a whole folder instead of just one file. <?php $mp3 = "1.mp3"; //The mp3 file. $filesize = filesize($mp3); $file = fopen("1.mp3", "r"); fseek($file, -128, SEEK_END); // It reads the $tag = fread($file, 3); if($tag == "TAG") { $data["song"] = trim(fread($file, 30)); $data["artist"] = trim(fread($file, 30)); $data["album"] = trim(fread($file, 30)); $data["year"] = trim(fread($file, 4)); $data["comment"] = trim(fread($file, 30)); $data["genre"] = trim(fread($file, 1)); } else die("MP3 file does not have any ID3 tag!"); fclose($file); while(list($key, $value) = each($data)) { print("$key: $value<br>\r\n"); } ?>
  10. So I am trying to write a script where it browses a folder and gets all the mp3 id3 data for all the mp3's in the folder. <?php $dir = TEMPLATEPATH . "/flash/music/"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($fileread = readdir($dh)) !== false) { if($fileread == "." || $fileread == ".." || $fileread == "index.php" ) continue; $fullpath = $dir . $fileread; echo "filename: <b>$fullpath</b>"; echo "<br>"; $musicfile = $fullpath; fopen($fullpath, 'r'); fseek($musicfile, -128, SEEK_END); $tag = fread($musicfile, 3); if($tag == "TAG") { $data["song"] = trim(fread($musicfile, 30)); $data["artist"] = trim(fread($musicfile, 30)); $data["album"] = trim(fread($musicfile, 30)); } else die("MP3 file does not have any ID3 tag!"); fclose($musicfile); while(list($key, $value) = each($data)) { print("$key: $value<br>\r\n"); } } } } ?> Its not working. I get this error: filename: /[my_server_path]/public_html/new/wp-content/themes/default/flash/music/09 Low.mp3 Warning: fseek(): supplied argument is not a valid stream resource in /[my_server_path]/public_html/new/wp-content/themes/default/functions.php on line 1039 Warning: fread(): supplied argument is not a valid stream resource in /[my_server_path]/public_html/new/wp-content/themes/default/functions.php on line 1041 MP3 file does not have any ID3 tag! Any help? Thanks.
  11. This is the wordpress admin system I created in the functions.php file that I was using this for. It loads the form values in from an xml file. The only thing thats not functional is, it doesn't save the data entered. I can add, remove, and edit the packages on the page, but it won't save it to the xml file it loads from. If anyone can lend me a hand that would be great!
  12. Ok I found a solution to read the xml: http://condiffphotography.com/xmledit.php <h2>Edit Pricing</h2> <form> <?php $doc = new DOMDocument(); $doc->load( 'pricing.xml' ); $pricing = $doc->getElementsByTagName( "package" ); foreach( $pricing as $package ) { $titles = $package->getElementsByTagName( "title" ); $title = $titles->item(0)->nodeValue; $prices = $package->getElementsByTagName( "price" ); $price = $prices->item(0)->nodeValue; $descriptions = $package->getElementsByTagName( "description" ); $description = $descriptions->item(0)->nodeValue; echo " <div style=\"padding:20px\"> Package:<br /> Title: <input type=\"text\" value=\"$title\" name=\"title\" /> <br /> Price: <input type=\"text\" value=\"$price\" name=\"price\" /> <br /> Description: <br /> <textarea name=\"description\" />$description</textarea><br /> <input type=\"button\" name=\"remove\" value=\"Remove Package\"><br /> </div> "; } ?> <input type="button" name="add" value="Add Package"><br /> <input type="submit" name="mysubmit" value="Submit"> </form> I just need this form to be functional. Thanks.
  13. I am designing a portfolio website for a photographer and I wanted to create an admin system for him to edit the flash website. My main question concerns the pricing page. I want to load the following XML into flash with as3: <pricing> <package> <name>Package 1</name> <price>$750</price> <description>This is a description of package 1.</description> </package> <package> <name>Package 2</name> <price>$1250</price> <description>his is a description of package 2.</description> </package> <package> <name>Package 3</name> <price>$1750</price> <description>his is a description of package 3.</description> </package> </pricing> So I want to be able to edit this data with PHP. There would be fields for each value with the value in the field. Package: Name:______________ Price:_______________ Description: ____________________ ____________________ ____________________ Also I want to be able to add and re-order packages. So there would be an "Add Package" button that adds a group of fields. Is this difficult to do? Sorry I am still learning PHP so any help would be greatly appreciated. =) 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.