Jump to content

MikeDXUNL

Members
  • Posts

    151
  • Joined

  • Last visited

    Never

Posts posted by MikeDXUNL

  1. I had a question and couldn't really pin-point a forum to put this post in, so I hope this suits my topic.

     

    You always hear "Facebook is rolling out a new feature"; most recently "Twitter is rolling out the New Twitter.com" but it only releases to so many people at time. Or friends will get features on Facebook before I do (like I couldn't like threaded comments until about a month after all my other friends could).

     

    I was just wondering if anyone knows the actual method or how large sites go about releasing new features to users?

  2. Alrighty,

     

    Say I have a site where there are these fields in the db.

     

    TABLE: photo_package

    FIELDS: product_id, gallery_id, title, productfam

     

    I need to, on a page, give every product in the family to display.

     

    So say I have.

     

    DATA:

    1, 4, mac book, 4

    2, 4, laptop, 4

    3, 3, some book, 4,3

     

    The last one has a productfam of 4 and 3 cause when on the 'Some Book' page, it should show Mac Book and Laptop as part of it's product family.

     

    What would be the best way to approach getting these values?

     

    Thanks in advance.

  3. Not sure if this helps at all, but you don't need to escape the quotations when using single quotes

     

    $theusers .= '<select name="adj[]"><option value="">Please Select</option>';

     

    Also, in your second piece of code, $i has no limit.

    something like while($i < count($someVAR)

     

    add this to your code and tell me what you get

    print_r($_POST['adj']);

  4. My script runs like this:

     

    <?php
    $parents = 'overview,brands,specs';
    $parents = explode(",", $parents);
    
    if (file_exists($filename)) {
        $xml = simplexml_load_file($filename, 'SimpleXMLElement', LIBXML_NOCDATA);
    
    } else {
        exit('Failed to open test.xml.');
    }
    
    echo '<form name="editXML" method="POST" action="#">';
    foreach($parents as $parent) {
    foreach($xml->$parent->children() as $name => $node) {
    
    	if(trim($node) == "") {
    		foreach($xml->$parent->$name->children() as $child => $body) {
    		echo '<b>'.$parent.' - '.$name.' - '.$child.'</b><br />';
    		echo "\n";
    	echo '<textarea name="'.$parent.'-'.$name.'-'.$child.'" style="width: 500px; height: 200px;">'.trim($body).'</textarea><br /><br />';
    	echo "\n";
    		}
    	} else {
    	echo '<b>'.$parent.' - '.$name.'</b><br />';
    	echo "\n";
    	echo '<textarea name="'.$parent.'-'.$name.'" style="width: 500px; height: 200px;">'.trim($node).'</textarea><br /><br />';
    	echo "\n";
    	}
    }
    }
    
    echo '<input type="submit" name="editXML" />';
    echo '</form>';
    ?>
    

     

    The problem lies with: foreach($xml->$parent->children() as $name => $node) {

     

    Not every .xml file has "overview, brands, specs" .. in this case, this file is missing "brands" is there a way I can argue if on of the $parents does not exist?

     

    Thanks in advance for help. :)

  5. <config>
    
    <overview>
    
    <body>
    Bafferts is the result of four generations of knowledge and refinement by one of the world's foremost gin distillers, the Hayman family, who have been distilling quality gin in the heart of London for over 200 years.
    
    The Bafferts recipe has been handed down through the Hayman family since the 1800s. To achieve its refreshing taste we infuse a special blend of botanicals that include orange peel, lemon peel, coriander, and a hint of juniper that compliment each other. The result is a lighter style of gin that is perfect for those who crave a crisp pure taste in a classic martini or gin and tonic.
    </body>
    </overview>
    
    <brands>
    
    <traditional>
    
    <body>
    
    
    Infused with a blend of four botanicals, Bafferts Gin offers a refined light taste perfect for use in martinis and other classic cocktails. 
    </body>
    </traditional>
    
    <mint>
    
    <body>
    
    
    The refined, light taste of Bafferts Original infused with the flavor of mint.
    </body>
    </mint>
    </brands>
    
    <specs>
    <bottlesize>
    		<ul><li>750mL</li></ul>
    	</bottlesize>
    <proof>
    		<ul><li>80</li></ul>
    	</proof>
    <accolades>
    		<ul><li>Something</li></ul>
    	</accolades>
    <features>
    		<ul><li>Something</li></ul>
    	</features>
    </specs>
    </config>

     

    That's what the XML looks like...

     

    I just want that displayed in a textarea. Seperated by Nodes.

     

    In the idea of this image:

    http://img269.imageshack.us/img269/5046/whatiwant.jpg

  6. Hello,

     

    What I am aiming to do, is display an XML file inside a <textarea> using the SimpleXML class.

     

    Here's what I have so far, but it isn't giving me anything what I'd like it to:

    <?php
      
    
    $filename = 'data/brands_bafferts.xml';
    
    
    
    // The file test.xml contains an XML document with a root element
    // and at least an element /[root]/title.
    
    if (file_exists($filename)) {
        $xml = simplexml_load_file($filename, 'SimpleXMLElement', LIBXML_NOCDATA);
    
    } else {
        exit('Failed to open test.xml.');
    }
    
    echo '<br /><br /><br />';
    
    
    foreach($xml->children() as $stuff) {
    echo '<'.$stuff->getName().'> <br />';
    echo $stuff.' <br />';
    
    foreach($stuff->children() as $bodies) {
    	echo '< BODY '.$bodies->getName().'> <br />';
    					echo $bodies.' <br />';
    
    						if($bodies->getName() != $stuff->getName()) {
    						echo '</'.$stuff->getName().'> <br />';
    						}
    		foreach($bodies->children() as $copies) {
    			echo '<'.$copies->getName().'> <br />';
    			echo $copies.' <br />';
    										if($copies->getName() != $bodies->getName()) {
    						echo '</'.$bodies->getName().'> <br />';
    						}
    			}
    	 }
    }
    
    
    
    
    ?>

     

    Help is appreciated!

    Thanks in advance! :)

  7. if ($result3 = mysql_db_query($database, "select * from $table WHERE confirmed = 'Yes'")) {

              if (mysql_num_rows($result3)) { 

                      echo '<font face=tahoma size=3>My Friends</font><br>';

                echo '<table align=left width=100%><tr>';

                $i = 1;

                  while ($qry = mysql_fetch_array($result2)) {

                      $friend = $qry[username];

                      $friend2 = strtoupper($friend);

                      echo '<td align=left width=150px><a href=galleries/members/'.$friend2.'><font face=tahoma size=2>'.$friend.'</font></a></td>';

                        if($i == 4)

                            {

                                echo '</tr><tr>';

                                $i = 0; // reset counter

     

        $i++;

                            }

                  }//end while

                echo '</tr></table>';

            }//end num rows

          }//end result3

    include("footer.php");

     

     

    try and put $i++ inside if($i == 4)

  8. Well, I am trying to empty the directory before I remove it.

     

    <?php
    $mydir = "../photos/".$newFolder.'/'; 
    $d = dir($mydir); 
    while($entry = $d->read()) { 
    if ($entry!= "." && $entry!= ".." && $entry!="Thumbs.db") { 
    unlink($entry); 
    } 
    } 
    $d->close(); 
    rmdir($mydir); 
    ?>
    

     

    Warning: unlink(header3.jpg) [function.unlink]: No such file or directory in C:\wamp\www\fitchbandadmin\admin\managephotos.php on line 87

     

    Warning: rmdir(../photos/New FOlder/) [function.rmdir]: Directory not empty in C:\wamp\www\fitchbandadmin\admin\managephotos.php on line 91

     

    that is the error that i get :(

    help is appreciated.

     

    Thanks,

    Mike

  9. Well, I know how to manually grab source code and break it apart into stuff I want via Regex.

    But is there a way to have a script run and grab static information from a site, without you manually having to do it?

     

    Thanks in advance for the help. :)

    Mike

  10. yeah i knew that, but like i said; i dont want to use two seperate queries. i am also using $result to display all the data on the page.

     

    and dclamp;

    your method would work, but some id's are not displayed with my query.

    some items in the database are > NOW() so $last would not always equal the last id selected from the database

  11. try

     

    <?php
    $this_file = strrchr($_SERVER['REQUEST_URI'], '/');
    $this_file = str_replace('/', '', $this_file);
    $file = explode("?", basename($this_file));
    $this_file = $file[0];
    
    echo '<ul>';
    
    echo '<li><a href="#" title="" ';
    	if($this_file == 'index.php' || $this_file == '')
    			echo 'class="current"';
    echo '>Home</a></li>
    
    
    <li><a href="#" title="" ';
    	if($this_file == 'aboutus.php')
    			echo 'class="current"';
    echo '>About Us</a></li>
    
    <li><a href="#" title="" ';
    	if($this_file == 'services.php')
    			echo 'class="current"';
    echo '>Services</a></li>
    
    <li><a href="#" title="" ';
    	if($this_file == 'ourwork.php')
    			echo 'class="current"';
    echo '>Our Work</a></li>
    
    <li><a href="#" title="" ';
    	if($this_file == 'contact.php')
    			echo 'class="current"';
    echo '>Contact Us</a></li>';
    
    echo '</ul>';
    ?>
    

  12. well, it works. but when i upload a file... say i have

     

    photo1.jpg

    photo2.jpg

     

    already uploaded...

     

    then i upload

     

    photo3.jpg

     

    i need it to be

    photo3.jpg, photo2.jpg, photo1.jpg

     

    in that order...

     

    when i run your script; it gives me photo1.jpg, photo2.jpg, photo3.jpg

  13. Warning: filetype() [function.filetype]: Lstat failed for ../photos//test test in C:\wamp\www\fitchband\admin\options.php on line 136

     

    Line 136: $type = filetype($path ."/". $file);

     

    <?php
    
    $path = '../photos/';
    	  
    	 $listDirectories    = true;
    
    if(is_dir($path))
    {
        $dir = opendir($path);
        while(false !== ($file = readdir($dir)))
        {
            $type = filetype($path ."/". $file);
            if($file != "." && $file != ".." && $file != "Thumbs.db" && $listDirectories && $type == "dir")
            {
                $list_dir[] = $file;
    
    		}
                
            }
        }
        closedir($dir);
    
    ?>

     

    one folder in my '../photos' dir is called 'test test'

     

    any clue as to why this happens?

    other folders, such as:

    Band Event 1

    Band test two

    Stuffff

     

    all work..

     

     

    ALSO: when i try to delete 'test test' from the photos folder on my pc, it says "Can not delete file: Can not read from source file or disk."

  14. list of directories and subs:

    + photos

    |---+ BAND EVENT 1

    |    |---gearsbg.jpg

    |

    |---+ BAND EVENT 2

    |    |--- brownsbg1.jpg

    |    |--- halobg1.jpg

    |

    |------ gearsbg.jpg

    |------ halobg1.jpg

    |------ brownsbg1.jpg

     

    (see attached file if you don't understand.)

     

    <?php
    $path = 'photos/';
    
    if($_SERVER['QUERY_STRING'] == 'albums') {
    $listDirectories    = true;
    
    if(is_dir($path))
    {
        $dir = opendir($path);
        while(false !== ($file = readdir($dir)))
        {
            $type = filetype($path ."/". $file);
            if($file != "." && $file != ".." && $file != "Thumbs.db" && $listDirectories && $type == "dir")
            {
                $list_dir[] = $file;
    
    		}
                
            }
        }
        closedir($dir);
        
        foreach($list_dir as $subdir) {
        	echo $subdir.'<br />';
    	if ($handle = opendir($path.$subdir)) {
        while (false !== ($files = readdir($handle))) {
            if ($files != "." && $files != "Thumbs.db" && $files != "..") {
               echo $files.'<br />';
               
        
    
            }
        }
        echo '<br />';
        closedir($handle);
    }
    }
    ?>
    

     

    this outputs:

    Band Event 1
    gearsbg.jpg
    
    Band Event 2
    brownsbg1.jpg
    halobg1.jpg
    

     

     

    which is correct. but for band event 2 i only want brownsbg1.jpg showing.

    help is appreciated. thanks in advance.

     

    - Mike

     

    [attachment deleted by admin]

×
×
  • 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.