Jump to content

Search the Community

Showing results for tags 'cdata'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Is it possible to append to cdatasection within xml file using a loop without creating a new cdata section with each loop thru. The code starts out by creating the basics for xml then enters into a loop to go thru each element of an array, appending the cdata. $xml=new DOMDocument('1.0', 'UTF-8'); $xml->preserveWhiteSpace = false; $xml->formatOutput = true; $components = $xml->createElement("components"); $name=$xml->createAttribute("name"); $name->value = "customEPGGrid"; $extends=$xml->createAttribute("extends"); $extends->value = "EPGGrid"; $components->appendChild($name); $components->appendChild($extends); $script = $xml->createElement("script"); $type=$xml->createAttribute("type"); $type->value = "text/brightscript"; foreach ($items as $item){ //ENTER INTO LOOP $cdata=$xml->createCDATASection(<<<EOT function init() m.content = createObject("RoSGNode","ContentNode") m.top.setFocus(true) dateNow = CreateObject("roDateTime") dateNow = dateNow.asSeconds() - 2000 addChannel({$item['name']}) addItem({$item['name']}, dateNow) m.top.content = m.content m.top.translation = [50, 300] m.top.numRows = 5 m.top.duration = 10800 m.top.nowNextMode = false m.top.infoGridGap = 0 m.top.channelInfoColumnLabel = "HELLO" end function sub addChannel(channelText as string) m.channel = m.content.createChild("ContentNode") m.channel.TITLE = channelText m.channel.HDSMALLICONURL = "http://css.boshanka.co.uk/wp-content/uploads/2015/04/icon-logo-design-small.png" end sub sub addItem(progText as string, timeStart) For i=0 To 5 Step 1 program = m.channel.createChild("ContentNode") program.TITLE = progText + str(i) program.PLAYSTART = timeStart + (i * 2000) program.PLAYDURATION = "2000" End For end sub EOT ); } $script->appendChild($cdata); $script->appendChild($type); $components->appendChild($script); $xml->appendChild($components); $xml->save($filename2); When executed like this, I get a new createCDATASection with each pass thru the loop. Not really wanting this, but one createCDATASection with different value or $item['name'].
  2. cmb

    Simplexml

    In searching how to wright cdata tags into my xml document using simpleXML i came across this example and when i try and use it Dreamweaver shows that lines 4-7 are wrong i try and run the code anyway and i get this error syntax error, unexpected T_VARIABLE on line 4 <?php class SimpleXMLExtended extends SimpleXMLElement{ public function addCData($cdata_text){ $node= dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $xml_doc = new SimpleXMLExtended('save.xml',NULL,TRUE); $email = $xml_doc->addChild('email'); $email->addAttribute('id',$id); $email->from = NULL; $email->from->addCData($from); $xml_doc->asXML('save.xml'); ?>
×
×
  • 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.