SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Southampton, United Kingdom
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    generate xml with php

    Hi,
    Just wondering if I can generate xml code in xml file below (for a pageflip) with a php while loop so I dont have to manually input pages/ab74.jpg to pages/ab120.jpg and what encoding should the page have?

    <content width="585" height="827" bgcolor="cccccc" loadercolor="ffffff" panelcolor="5d5d61" buttoncolor="5d5d61" textcolor="ffffff">

    <page src="pages/ab62.jpg"/>
    <page src="pages/ab63.jpg"/>
    <page src="pages/ab64.jpg"/>
    <page src="pages/ab65.jpg"/>
    <page src="pages/ab66.jpg"/>
    <page src="pages/ab67.jpg"/>
    <page src="pages/ab68.jpg"/>
    <page src="pages/ab69.jpg"/>
    <page src="pages/ab70.jpg"/>
    <page src="pages/ab71.jpg"/>
    <page src="pages/ab72.jpg"/>
    <page src="pages/ab73.jpg"/>
    <page src="pages/ab74.jpg"/>
    </content>

    many thanks

  2. #2
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Dhaka, Bangladesh
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
        
    echo htmlspecialchars('<content width="585" height="827" bgcolor="cccccc" loadercolor="ffffff" panelcolor="5d5d61" buttoncolor="5d5d61" textcolor="ffffff">
    '
    ENT_QUOTES'UTF-8') . '<br />';
        
        for(
    $i 63$i <= 120$i++) {
            echo 
    htmlspecialchars('<page src="pages/ab' $i '.jpg"/>'ENT_QUOTES'UTF-8') . '<br />';
        }
        
        echo 
    htmlspecialchars('</content>'ENT_QUOTES'UTF-8');
    ?>
    Just run this PHP script, and save the output using *.xml filename extension. I'm not sure if this is what you're looking for.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •