Sign up to create your own snipts, or login.

Public snipts » php The latest public php snipts.

showing 1-20 of 352 snipts for php
  • number of records in recordset
    $result = mysql_query($query) or die(mysql_error());
    $count = mysql_num_rows($result);
    echo "$count";
    

    copy | embed

    0 comments - tagged in  posted by mgrobertson on Mar 11, 2010 at 1:10 p.m. EST
  • display all array keys and vals
    foreach($HTTP_SERVER_VARS as $key => $value){
    print "$key: $value<br>";
    

    copy | embed

    0 comments - tagged in  posted by mgrobertson on Mar 11, 2010 at 1:09 p.m. EST
  • Variables de servidor de PHP
    <?php
    $_SERVER['PHP_SELF']
    // El nombre de archivo del script ejecutándose actualmente
    $_SERVER['SERVER_ADDR']
    //La dirección IP del servidor bajo la cual está siendo ejecutado el script actual.
    $_SERVER['QUERY_STRING']
    // La cadena de consulta, si existe, mediante la cual se accedió a la página.
    $_SERVER['HTTP_REFERER']
    // La dirección de la página que refirió al navegador a la página actual.
    $_SERVER['HTTP_USER_AGENT']
    // Esta es una cadena que denota el navegador que está accediendo a la página.
    $_SERVER['REMOTE_ADDR']
    // La dirección IP desde donde el usuario está observado la página actual.
    $_SERVER['SCRIPT_NAME']
    // Contiene la ruta del script actual, útil para páginas que necesitan apuntar a ellas mismas.
    $_SERVER['REQUEST_URI']
    // El URI que fue dado para acceder a esta página; por ejemplo, '/index.php?id=1'.
    ?>
    

    copy | embed

    0 comments - tagged in  posted by rmondragon on Mar 10, 2010 at 7:26 p.m. EST
  • Generate nooku packages
    <?php
    /*Save this file as generate.php in your component's root directory
     * Example command (will create a controller and a view named foo):
     * php generate.php foo cv
     * Possible options in the second argument is vcmrth (view, controller, model, row, table, helper)
     */
    
    //The packages to create is taken from the second argument
    $packages = str_split($argv[2]);
    
    //The component name is taken from the parent directory
    $component = ucfirst(substr(strrchr(getcwd(), '_'), 1));
    
    //The name of the file to be created
    $filename = $argv[1];
    
    //The name to be used in class names
    $name = ucfirst($filename);
    
    //Save the file
    function save ($folder, $file) {
      global $filename;
    
      if (!is_dir($folder)) {
        mkdir($folder);
      }
      if (!file_exists("$folder/$filename.php")) {
        file_put_contents("$folder/$filename.php", $file);
      } else {
        print "$folder/$filename.php already exist
    ";
      }
    }
    //View
    if (in_array('v', $packages)) {
      $file = "<?php
    class Com{$component}View{$name}Html extends ComDefaultViewHtml {
    
    }
    ?>";
      if (!is_dir("views/$filename/tmpl")) {
        mkdir("views/$filename/tmpl", 0777, true);
      }
      if (!file_exists("views/$filename/html.php")) {
        file_put_contents("views/$filename/html.php", $file);
      } else {
        print "views/$filename/html.php already exist
    ";
      }
    }
    
    //Controller
    if (in_array('c', $packages)) {
      $file = "<?php
    class Com{$component}Controller{$name} extends ComDefaultControllerView {
    
    }
    ?>";
      save('controllers', $file);
    }
    
    //Model
    if (in_array('m', $packages)) {
      $file = "<?php
    class Com{$component}Model{$name} extends KModelTable {
    
    }
    ?>";
      save('models', $file);
    }
    
    //Rows
    if (in_array('r', $packages)) {
      $file = "<?php
    class Com{$component}Row{$name} extends KDatabaseRowAbstract {
    
    }
    ?>";
      save('
        rows', $file);
    }
    
    //Table
    if (in_array('t', $packages)) {
      $file = "<?php
    class Com{$component}Table{$name} extends KDatabaseTableAbstract {
    
    }
    ?>";
      save('tables', $file);
    }
    
    //Helper
    if (in_array('h', $packages)) {
      $file = "<?php
    class Com{$component}Helper{$name} extends KObject {
    
    }
    ?>";
      save('helpers', $file);
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by theDigger on Mar 09, 2010 at 8:30 a.m. EST
  • Get all enum values from MySQL database
    /**
     *
     * @return array
     */
    function get_enum_values()
    {
      $enum_result = array();
      $sql = "SHOW COLUMNS FROM {$tablename} ";
      $rs = $adodb->Execute($sql);
      if ( ! $rs )
      {
        set_error($adodb->ErrorMsg());
        return FALSE;
      }
      if ( $rs->RecordCount() > 0 )
      {
        while ( $row = $rs->FetchRow() )
        {
          if ( ereg(('set|enum'), $row['Type']) )
          {
            eval(ereg_replace('set|enum', '$'.$row['Field'].' = array', $row['Type']).';');
            $enum_result[strtolower($row['Field'])] = array_combine($$row['Field'], $$row['Field']);
          }
        }
      }
    
      return $enum_result;
    }
    

    copy | embed

    0 comments - tagged in  posted by donnykurnia on Mar 04, 2010 at 3:54 a.m. EST
  • Truncate Strings
    <?php
    
    // truncate with smart check for spaces
    function truncate($string, $limit = 75, $break = " ", $pad = "...") 
    {
        if (strlen($string) <= $limit) return $string; 
        
        $string = substr($string, 0, $limit); 
        if (false !== ($breakpoint = strrpos($string, $break))) 
        {
            $string = substr($string, 0, $breakpoint);
        }
        return $string . $pad; 
    }
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Mar 02, 2010 at 10:23 a.m. EST
  • install MediaWiki and CKEditor
    wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz
    
    tar -zxvf mediawiki-1.15.1.tar.gz
    
    open http://www.yoursite.com/w/config/index.php, and configure MediaWiki:
    http://doc.guanlannet.com/config/index.php
    
    finally, change memory usage for MediaWiki:
    edit ../LocalSettings.php, change to 
    ini_set( 'memory_limit', '32M' );
    
    
    wget http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.2/ckeditor_3.2.tar.gz
    tar -zxvf ckeditor_3.2.tar.gz
    vi LocalSettings.php, add the following:
    require_once("extensions/ckeditor/ckeditor.php");
    
    reference page 1: http://mediawiki.fckeditor.net/
    reference page 2: http://mediawiki.fckeditor.net/index.php/FCKeditor_integration_guide
    

    copy | embed

    0 comments - tagged in  posted by iamacnhero on Feb 26, 2010 at 2:52 a.m. EST
  • PHP Array to XML (with attributes)
    <?php
    //
    /*
        Example usage:
        ===============
        $xml = "
        <library id='123' test='456'>
            <book>
                <authorFirst>Mark</authorFirst>
                <authorLast>Twain</authorLast>
                <title>The Innocents Abroad</title>
            </book>
            <book>
                <authorFirst>Charles</authorFirst>
                <authorLast>Dickens</authorLast>
                <title>Oliver Twist</title>
            </book>
        </library>";
        
        echo "<pre>";
        var_export(ArrayToXML::xml2array($xml));
        ===============
        
        $library = array(
            'library' => array(
                '_a' => array( 'id'=>'1234', 'test'=>'456' ),
                '_c' => array( 'book' => array(
                    '_c' => array(
                        'authorFirst' => array( '_v' => 'Mark' ),
                        'authorLast'  => array( '_v' => 'Twain' ),
                        'title'       => array( '_v' => 'The Innocents Abroad' )
                        ),
                    '_c' => array(
                        'authorFirst' => array( '_v' => 'Charles' ),
                        'authorLast'  => array( '_v' => 'Dickens' ),
                        'title'       => array( '_v' => 'Oliver Twist' )
                        ),
                    )
                )
            )
        );
        header('Content-Type: application/xml');
        echo ArrayToXML::array2xml($library);
        
    */
    class ArrayToXML
    {
        // Array to XML
        public static function array2xml($cary, $d=0, $forcetag='') {
            $res=array();
            foreach ($cary as $tag=>$r) {
                if (isset($r[0])) {
                    $res[]=ArrayToXML::array2xml($r, $d, $tag);
                } else {
                    if ($forcetag) $tag=$forcetag;
                    $sp=str_repeat("\t", $d);
                    $res[]="$sp<$tag";
                    if (isset($r['_a'])) {foreach ($r['_a'] as $at=>$av) $res[]=" $at=\"$av\"";}
                    $res[]=">".((isset($r['_c'])) ? "\n" : '');
                    if (isset($r['_c'])) $res[]=ArrayToXML::array2xml($r['_c'], $d+1);
                    elseif (isset($r['_v'])) $res[]=$r['_v'];
                    $res[]=(isset($r['_c']) ? $sp : '')."</$tag>\n";
                }
                
            }
            return implode('', $res);
        }
        
        // XML to Array
        public static function xml2array(&$string) {
            $parser = xml_parser_create();
            xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
            xml_parse_into_struct($parser, $string, $vals, $index);
            xml_parser_free($parser);
    
            $mnary=array();
            $ary=&$mnary;
            foreach ($vals as $r) {
                $t=$r['tag'];
                if ($r['type']=='open') {
                    if (isset($ary[$t])) {
                        if (isset($ary[$t][0])) $ary[$t][]=array(); else $ary[$t]=array($ary[$t], array());
                        $cv=&$ary[$t][count($ary[$t])-1];
                    } else $cv=&$ary[$t];
                    if (isset($r['attributes'])) {foreach ($r['attributes'] as $k=>$v) $cv['_a'][$k]=$v;}
                    $cv['_c']=array();
                    $cv['_c']['_p']=&$ary;
                    $ary=&$cv['_c'];
    
                } elseif ($r['type']=='complete') {
                    if (isset($ary[$t])) { // same as open
                        if (isset($ary[$t][0])) $ary[$t][]=array(); else $ary[$t]=array($ary[$t], array());
                        $cv=&$ary[$t][count($ary[$t])-1];
                    } else $cv=&$ary[$t];
                    if (isset($r['attributes'])) {foreach ($r['attributes'] as $k=>$v) $cv['_a'][$k]=$v;}
                    $cv['_v']=(isset($r['value']) ? $r['value'] : '');
    
                } elseif ($r['type']=='close') {
                    $ary=&$ary['_p'];
                }
            }    
            
            ArrayToXML::_del_p($mnary);
            return $mnary;
        }
    
        // _Internal: Remove recursion in result array
        public static function _del_p(&$ary) {
            foreach ($ary as $k=>$v) {
                if ($k==='_p') unset($ary[$k]);
                elseif (is_array($ary[$k])) ArrayToXML::_del_p($ary[$k]);
            }
        }
        
        // Insert element into array
        public static function ins2ary(&$ary, $element, $pos) {
            $ar1=array_slice($ary, 0, $pos); $ar1[]=$element;
            $ary=array_merge($ar1, array_slice($ary, $pos));
        }
    }
    }
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 24, 2010 at 2:17 p.m. EST
  • PHP Array to XML
    <?php
    //
    // 
    /*
        Example usage:
        ===============
        <library>
            <book>
                <authorFirst>Mark</authorFirst>
                <authorLast>Twain</authorLast>
                <title>The Innocents Abroad</title>
            </book>
            <book>
                <authorFirst>Charles</authorFirst>
                <authorLast>Dickens</authorLast>
                <title>Oliver Twist</title>
            </book>
        </library>
        
        =================
        $library = array(
            'book' => array(
                array(
                    'authorFirst' => 'Mark',
                    'authorLast' => 'Twain',
                    'title' => 'The Innocents Abroad'
                ),
                array(
                    'authorFirst' => 'Charles',
                    'authorLast' => 'Dickens',
                    'title' => 'Oliver Twist'
                )
            )
        );
        header('Content-Type: application/xml');
        echo ArrayToXML::toXML($library, 'library');
    */
    
        
    class ArrayToXML
    {
        /**
         * The main function for converting to an XML document.
         * Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
         *
         * @param array $data
         * @param string $rootNodeName - what you want the root node to be - defaultsto data.
         * @param SimpleXMLElement $xml - should only be used recursively
         * @return string XML
         */
        public static function toXML( $data, $rootNodeName = 'ResultSet', &$xml=null ) {
    
            // turn off compatibility mode as simple xml throws a wobbly if you don't.
            if ( ini_get('zend.ze1_compatibility_mode') == 1 ) ini_set ( 'zend.ze1_compatibility_mode', 0 );
            if ( is_null( $xml ) ) //$xml = simplexml_load_string( "" );
                $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
    
            // loop through the data passed in.
            foreach( $data as $key => $value ) {
    
                $numeric = false;
                
                // no numeric keys in our xml please!
                if ( is_numeric( $key ) ) {
                    $numeric = 1;
                    $key = $rootNodeName;
                }
    
                // delete any char not allowed in XML element names
                $key = preg_replace('/[^a-z0-9\-\_\.\:]/i', '', $key);
    
                // if there is another array found recrusively call this function
                if ( is_array( $value ) ) {
                    $node = ArrayToXML::isAssoc( $value ) || $numeric ? $xml->addChild( $key ) : $xml;
    
                    // recrusive call.
                    if ( $numeric ) $key = 'anon';
                    ArrayToXML::toXml( $value, $key, $node );
                } else {
    
                    // add single node.
                    $value = htmlentities( $value );
                    $xml->addChild( $key, $value );
                }
            }
    
            // pass back as XML
            return $xml->asXML();
    
        // if you want the XML to be formatted, use the below instead to return the XML
            //$doc = new DOMDocument('1.0');
            //$doc->preserveWhiteSpace = false;
            //$doc->loadXML( $xml->asXML() );
            //$doc->formatOutput = true;
            //return $doc->saveXML();
        }
    
    
        /**
         * Convert an XML document to a multi dimensional array
         * Pass in an XML document (or SimpleXMLElement object) and this recrusively loops through and builds a representative array
         *
         * @param string $xml - XML document - can optionally be a SimpleXMLElement object
         * @return array ARRAY
         */
        public static function toArray( $xml ) {
            if ( is_string( $xml ) ) $xml = new SimpleXMLElement( $xml );
            $children = $xml->children();
            if ( !$children ) return (string) $xml;
            $arr = array();
            foreach ( $children as $key => $node ) {
                $node = ArrayToXML::toArray( $node );
    
                // support for 'anon' non-associative arrays
                if ( $key == 'anon' ) $key = count( $arr );
    
                // if the node is already set, put it into an array
                if ( isset( $arr[$key] ) ) {
                    if ( !is_array( $arr[$key] ) || $arr[$key][0] == null ) $arr[$key] = array( $arr[$key] );
                    $arr[$key][] = $node;
                } else {
                    $arr[$key] = $node;
                }
            }
            return $arr;
        }
    
        // determine if a variable is an associative array
        public static function isAssoc( $array ) {
            return (is_array($array) && 0 !== count(array_diff_key($array, array_keys(array_keys($array)))));
        }
    }
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 23, 2010 at 11:43 a.m. EST
  • backup DB with PHP script+Ajax
    <?php 
    // in adminDBSuccess.php template file, call another action "ajaxBackup" with Ajax
    echo jq_link_to_remote(image_tag('backup'),
        array
        (
          'update' =>'feedback_backup',
          'url'    =>'homepage/ajaxBackup',
          'loading' => jq_visual_effect('fadeIn',  '#indicator_backup'),
          'complete'=> jq_visual_effect('fadeOut', '#indicator_backup')
        ));
    ?>
    
    // action ajaxBackup in actions.class.php
    public function executeAjaxBackup(sfWebRequest $request)
    {
      return $this->renderPartial('homepage/backupDBSuccess');
    }
    
    //_backupDBSuccess.php partial template
    <?php if(!require_once(dirname(__FILE__).'/../../../../../web/backup.php')): ?>
      <?php echo "backup.php file not found or it doesn't work correctly." ?>
    <?php endif; ?>
    
    // backup.php script to backup DB
    <?php
    include('db_config.php');
    
    backup_tables($dbhost,$dbuser,$dbpassword,$dbname,$tables, $backup_dir);
    
    /* backup the db OR just a table */
    function backup_tables($host,$user,$pass,$name,$tables, $backup_dir)
    {
    	$return ='';
    	$link = mysql_connect($host,$user,$pass);
    	mysql_select_db($name,$link);
    	
    	//get all of the tables
    	if($tables == '*')
    	{
    		$tables = array();
    		$result = mysql_query('SHOW TABLES');
    		while($row = mysql_fetch_row($result))
    		{
    			$tables[] = $row[0];
    		}
    	}
    	else
    	{
    		$tables = is_array($tables) ? $tables : explode(',',$tables);
    	}
    	
    	//cycle through
    	$return.='SET FOREIGN_KEY_CHECKS=0;'."\n";
    	foreach($tables as $table)
    	{
    		$result = mysql_query('SELECT * FROM '.$table);
    		$num_fields = mysql_num_fields($result);
    		
    		$return.= 'DROP TABLE '.$table.';';
    		$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
    		$return.= "\n\n".$row2[1].";\n\n";
    		
    		for ($i = 0; $i < $num_fields; $i++) 
    		{
    			while($row = mysql_fetch_row($result))
    			{
    				$return.= 'INSERT INTO '.$table.' VALUES(';
    				for($j=0; $j<$num_fields; $j++) 
    				{
    					$row[$j] = addslashes($row[$j]);
    					$row[$j] = ereg_replace("\n","\\n",$row[$j]);
    					if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
    					if ($j<($num_fields-1)) { $return.= ','; }
    				}
    				$return.= ");\n";
    			}
    		}
    		$return.="\n\n\n";
    	}
    	$return.='SET FOREIGN_KEY_CHECKS=1;'." \n";
    	
    	//save file
            
    	//$handle = fopen($backup_dir.'db-backup-'.date('Y-m-d').'-'.(md5(implode(',',$tables))).'.sql','w+');
    	$filename = date('Y-m-d_H:i:s').'.sql';
    	$handle = fopen($backup_dir.$filename,'w+');
    	fwrite($handle,$return);
    	echo sprintf('[%s] DB backup successed !<br> <small>%s</small><br>',date('Y-m-d H:i:s'),$backup_dir.$filename);
    	fclose($handle);
    }//end function
    
    // DB configuration file db_config.php
    <?php
    
    
    // please configurate here your db connection and path of backup
    $dbhost = "localhost";
    
    $dbname = "kqb";
    
    $dbuser = "root";
    
    $dbpassword = "something";
    
    $tables ='*'; //if only one table should be saved, give the name of table. Default *, means any table in DB
    
    $backup_dir ='/var/www/clean/kqb-v2/backup/'; // Folder where sql should be stored, please "chmodd 777 $backup_dir"
    

    copy | embed

    0 comments - tagged in  posted by toledot on Feb 23, 2010 at 7:30 a.m. EST
  • How to handle sessions into Joomla Framework
    <?php
    // Set session var
    $session =& JFactory::getSession();
    $value = "paris";
    $session->set('siteshop', $value);
    
    // Get session var
    $session =& JFactory::getSession();
    $mainframe->addCustomHeadTag('<META name="'.$session->get('siteshop').'" content="test"/>');
    ?>
    

    copy | embed

    0 comments - tagged in  posted by bmrateb on Feb 23, 2010 at 5:27 a.m. EST
  • Enable SOAP on Media Temple DV server
    # Navigate to a relatively unimportant directory. I chose /home/
    cd /home/
    
    # Download PHP (http://www.php.net/releases/)
    wget http://museum.php.net/php5/php-5.2.6.tar.gz
    
    # Unpack the PHP file
    tar -zxf php-5.2.6.tar.gz
    
    # Configure the new PHP to enable SOAP (will take a few minutes) (before enable is two dashes)
    cd php-5.2.6
    ./configure --enable-soap=shared
    
    # Rebuild PHP (this will also take a while)
    make
    
    # Copy just the SOAP module into your existing installation of PHP
    cp modules/soap.so /usr/lib/php/modules/
    
    # Add the new SOAP configuration to your existing configuration
    echo "extension=soap.so" > /etc/php.d/soap.ini
    
    # Restart Apache
    /etc/init.d/httpd restart
    
    # Optional: You can now delete /home/php-5.2.6/ if you’d like, as you won’t need it any longer.
    rm -rf /home/php-5.2.6/
    
    # Check phpinfo() to confirm that SOAP is now enabled.
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 22, 2010 at 8:45 p.m. EST
  • getting rid of foreach error
    <?php
    // double any value whose key starts with 'b'
    $arr = array('a'=>1, 'b1'=>2, 'b2'=>3, 'c'=>4, 'd'=>5);
    $non_array = null;
    
    // Normal usage with an array
    print "Test 1:\n";
    foreach ($arr as $key => $val) {
        print "Key $key, Value $val\n";
    
    }
    
    // Normal usage with a non-array (undefined or otherwise empty data set)
    // Outputs: Warning: Invalid argument supplied for foreach() in test.php on line 16
    print "Test 2:\n";
    foreach ($non_array as $key => $val) {
        print "Key $key, Value $val\n";
    }
    
    // By casting the $non_array to an (array) type, it will function without error, skipping the loop
    print "Test 3:\n";
    foreach ((array) $non_array as $key => $val) {
        print "Key $key, Value $val\n";
    }
    
    print "Done.\n";
    
    ?>
    

    copy | embed

    0 comments - tagged in  posted by d13t on Feb 22, 2010 at 4:39 a.m. EST
  • Show custom field only if populated
    <?php $FIELDNAME = get_post_meta($post->ID, 'FIELDNAME', true);
    	
    	if($FIELDNAME) : ?>
    
    	<a title="Click Here To Purchase Tickets" href="<?php get_custom_field_value('FIELDNAME', true) ?>" rel="bookmark">PURCHASE TIX</a>
    
    	<?php endif; ?>
    

    copy | embed

    0 comments - tagged in  posted by actionbasic on Feb 18, 2010 at 2:49 p.m. EST
  • PHP Date format
    <?php 
    // reference http://php.net/manual/en/function.date.php for date formatting
    print date("D, j M, Y \a\\t G:i", $event_start);
    

    copy | embed

    0 comments - tagged in  posted by markbgh on Feb 17, 2010 at 12:43 p.m. EST
  • random md5
    md5(uniqid(rand(), true));
    

    copy | embed

    0 comments - tagged in  posted by nicolascormier on Feb 08, 2010 at 7:49 p.m. EST
  • Get the nth sentence from the post (beta)
    <?php
    function the_nth_sentence($sentence_num = 1) {
    	if ($sentence_num == 0) {
    		return false;
    	}
    	if ($sentence_num >= 1) {
    		$sentence_num = $sentence_num-1;
    	}
    	$content = get_the_content('',FALSE,'');
    	$content = apply_filters('the_content', $content);
    	$content = strip_tags($content);
    	$pos = strpos($content, '.');
    	for($i=1; $i<=$sentence_num; $i++) {
    		$pos = strpos($content, '.', $pos+1);
    	}
    	echo '<p>' . substr($content,0,$pos+1) . '</p>';
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by depi on Feb 03, 2010 at 1:55 p.m. EST
  • show php errors
    ini_set('display_errors', "1");
    ini_set('error_reporting', E_ALL ^ E_NOTICE);
    

    copy | embed

    0 comments - tagged in  posted by pazzypunk on Feb 02, 2010 at 2:20 p.m. EST
  • Backup index.php Super45.net
    <?php get_header(); ?>
    
     <div id="row1">
      <div id="discodestacado">
           <h2><img src="/images/disco-destacado.png" alt="Disco Destacado" /></h2>
    	   <div id="contenedor-disco">
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=1488');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
                        <div id="foto-tit-dd">
    			<div id="fotodd"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div id="titdd"><h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3></div>
                         </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?> 
    	   </div>
      </div><!-- end of discodestacado div -->
      <div id="otrosdiscos">
             <h2><img src="/images/en-breve.png" alt="En Breve" /></h2>
    		 <div id="slider">
    			<ul>
    
    
    				<li>
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    				</li>
    				
    				<li>
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&offset=6&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    				</li>
    			
    				<li>
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&offset=12&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    				</li>
    				
    
    				
    			</ul>
    		 </div>
      </div><!-- end of otrosdiscos div -->
    
    
    
      <div id="publi1">
    <script type='text/javascript'><!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'https://open.estupendos.net/www/delivery/ajs.php':'http://open.estupendos.net/www/delivery/ajs.php');
       var m3_r = Math.floor(Math.random()*99999999999);
       if (!document.MAX_used) document.MAX_used = ',';
       document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
       document.write ("?zoneid=2");
       document.write ('&amp;cb=' + m3_r);
       if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
       document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
       document.write ("&amp;loc=" + escape(window.location));
       if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
       if (document.context) document.write ("&context=" + escape(document.context));
       if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
       document.write ("'><\/scr"+"ipt>");
    //]]>--></script><noscript><a href='http://open.estupendos.net/www/delivery/ck.php?n=a75a6856&amp;cb=23544353' target='_blank'><img src='http://open.estupendos.net/www/delivery/avw.php?zoneid=2&amp;cb=23544353&amp;n=a75a6856' border='0' alt='' /></a></noscript>
      </div><!-- end of publi1 div -->
    
    
    
     </div><!-- end of row1 div -->
    
    
    
    
     <div id="row2">
      <div id="destacado">
    	     <h2><img src="/images/destacamos.png" alt="Destacamos en S45" /></h2>
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=1509');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div id="contenedor-destacado">
    			<div class="foto-destacado"><?php get_the_image('custom_key=foto-home&default_size=full&default_image=/images/medium.png'); ?></div>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<p class="metadata"><?php
    foreach((get_the_category()) as $cat) {
    if ($cat->cat_ID != "1509" )
    {
    echo '<a href="/?cat=' . $cat->cat_ID . '"> ' .
    $cat->cat_name . '</a> ';
    }
    }
    ?> | Por <?php the_author_posts_link(); ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    		 </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=5&offset=1&cat=1509');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php
    foreach((get_the_category()) as $cat) {
    if ($cat->cat_ID != "1509" )
    {
    echo '<a href="/?cat=' . $cat->cat_ID . '"> ' .
    $cat->cat_name . '</a> ';
    }
    }
    ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    		 <div class="clear-destacado"></div>
    			<?php endwhile; ?>
    		<?php else : ?>
    		<?php endif; ?>
    
    
    
    
    		 
      </div><!-- end of destacado div -->
      <div id="articulos">
    	<ul>
    		<li><a href="#tabs-1"><img src="/images/blog.png" alt="Blog" /></a></li>
    		<li><a href="#tabs-2"><img src="/images/noticias.png" alt="Noticias" /></a></li>
    		<li><a href="#tabs-3"><img src="/images/articulos.png" alt="Articulos" /></a></li>
    	</ul>
    
    	<div id="tabs-1">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=8&cat=41');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    	
            <div class="vertodos"><a href="/seccion/blog/" title="Ver todo el blog">[+] Ver todos</a></div>	 
    
    
    
    	</div>
    
    	<div id="tabs-2">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=8&cat=3');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    <div class="vertodos"><a href="/seccion/noticias/" title="Ver todas las noticias">[+] Ver todos</a></div>
    		 
    
    	</div>
    	
    	<div id="tabs-3">   
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=42');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div id="contenedor-articulo">
    
    
    
    			<div class="contenedor-foto-articulo"><?php get_the_image('custom_key=foto-home&default_size=full&default_image=/images/medium.png'); ?></div>
                            <div class="cat-arti"><?php the_category(); ?></div>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<p class="metadata">Por <?php the_author_posts_link(); ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    		 </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>		 
    
    
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=5&offset=1&cat=42,44,45');
    ?>
    		<?php while (have_posts()) : the_post(); ?>		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
                            <div class="cat-arti"><?php the_category(); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>		 
    		 
    		
    
    <div class="vertodos"><a href="/seccion/articulos/" title="Ver todos los artículos">[+] Ver todos</a></div>
    
    	</div>
    
    	
      </div><!-- end of articulos div -->
      <div id="radio">
        <div id="s45radio">
    
    		<h2><img src="/images/2009/06/super-45-radio.png" alt="S45 en Radio Duna" /></h2>
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=49');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    	    <div id="foto-radio"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
            <div id="txt-radio">
    			<span class="prox-radio">Pr&oacute;ximo programa:<br /></span>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<?php the_excerpt() ?>
    		</div>	 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    		<div class="podcast">
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=21');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
            <div id="txt-podcast">
    			<p class="podcast-anterior">Descarga el programa anterior:</p>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<div class="excerpt-podcast"><?php the_excerpt() ?></div>
    	</div>	 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		</div>
    	</div>	
    	<div id="ad-radio1"></div>		 
    
    
    
      <div id="agenda">
    	<ul>
    		<li><a href="#tabs-4"><img src="/images/nuestra_agenda.png" alt="Nuestra Agenda" /></a></li>
    		<li><a href="#tabs-5"><img src="/images/cartelera.png" alt="Cartelera" /></a></li>
    		<li><a href="#tabs-6"><img src="/images/concursos.png" alt="Concursos" /></a></li>
    	</ul>
    
    	<div id="tabs-4">   
    	 
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=2&cat=1511');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    					<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		 
    		 
    
    	</div>
    
    	<div id="tabs-5">
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=35');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado25"></div>
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		 
    		 
    		 
    
    	</div>
    	
    	<div id="tabs-6">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=66');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado2"></div>
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=2&offset=1&cat=66');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 
    		 <div class="sub-concurso">
    			<div class="txt-sub-concurso">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    <?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    		 
    
    		 
    
    		 
    
    	</div>
    
    	
      </div><!-- end of agenda div -->
    
    
    
      
      
      	<div id="ad-radio2"><a href="http://sonik.cl"><img src="/images/300x100-Sonik-S45.gif" alt="Sonik" /></a></div>		 
    
    
    
      	<div id="ad-radio3">
    
    <script type='text/javascript'><!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'https://open.estupendos.net/www/delivery/ajs.php':'http://open.estupendos.net/www/delivery/ajs.php');
       var m3_r = Math.floor(Math.random()*99999999999);
       if (!document.MAX_used) document.MAX_used = ',';
       document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
       document.write ("?zoneid=5");
       document.write ('&amp;cb=' + m3_r);
       if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
       document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
       document.write ("&amp;loc=" + escape(window.location));
       if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
       if (document.context) document.write ("&context=" + escape(document.context));
       if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
       document.write ("'><\/scr"+"ipt>");
    //]]>--></script><noscript><a href='http://open.estupendos.net/www/delivery/ck.php?n=a5a9a894&amp;cb=5467546' target='_blank'><img src='http://open.estupendos.net/www/delivery/avw.php?zoneid=5&amp;cb=5467546&amp;n=a5a9a894' border='0' alt='' /></a></noscript>
    
    
    </div>		 
    
    	
    
    
    <div id="tla"><?php tla_ads(); ?><br/><?php if (is_callable(array("LinkLiftPlugin", "execute"))) LinkLiftPlugin::execute(); ?></div>
    	
    	
      
      </div><!-- end of radio div -->
     </div><!-- end of row2 div -->
     <div id="row3">
       	     <h2>Comunidad Super 45</h2>
      <div id="eventos">
        	<h3><a href="http://vimeo.com/super45">Noa Noa</a></h3>
    		<div class="videos-oficiales">
    			<!-- START Vimeo Badge ... info at http://vimeo.com/widget -->
    			<div class="vimeoBadge">
    				<script type="text/javascript" src="http://vimeo.com/super45/badgeo/?stream=uploaded&amp;stream_id=&amp;count=4&amp;thumbnail_width=100&amp;show_titles=no"></script>
    			</div>
    			<!--END Vimeo Badge-->
    
    		</div>
    		
    		
      </div><!-- end of eventos div -->
      <div id="vimeo">
    		<h3><a href="http://vimeo.com/channels/super45">Canal Vimeo</a></h3>
    		
    		
    		<!-- START Vimeo Badge ... info at http://vimeo.com/widget -->
    <div class="vimeoBadge">
    		<script type="text/javascript" src="http://vimeo.com/super45/badgeo/?stream=channel&amp;stream_id=34616&amp;count=6&amp;thumbnail_width=100&amp;show_titles=no"></script>
    	</div>
    <!--END Vimeo Badge-->
    
    
    
    
    
    
      </div><!-- end of vimeo div -->
      <div id="flickr">
    	<h3><a href="http://www.flickr.com/super45/">Super 45 en Flickr</a></h3>
    	<div id="contenedor-flickr">
    <!-- Start of Flickr Badge -->
    <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=5&amp;display=latest&amp;size=s&amp;layout=x&amp;source=user&amp;user=39096086%40N04"></script>
    <!-- End of Flickr Badge -->
    
    	</div>
      </div><!-- end of flickr div -->
      <div id="sociales">
    	<ul>
    		<li><a class="facebook" href="http://facebook.com/group.php?gid=13967200331">Grupo Facebook</a></li>
    		<li><a class="facebook" href="http://facebook.com/pages/Santiago-Chile/Super-45/14050945943">P&aacute;gina Facebook</a></li>
    		<li><a class="twitter" href="http://twitter.com/super45">Twitter</a></li>
    		<li><a class="lastfm" href="http://last.fm/group/Super+45">Grupo Last.fm</a></li>
    	</ul>
      </div><!-- end of sociales div -->
     </div><!-- end of row3 div -->
     
     
     <?php get_footer(); ?>
    

    copy | embed

    0 comments - tagged in  posted by estupendos on Jan 28, 2010 at 2:19 p.m. EST
  • PHP reads from text file and write into YML file
    <?
    $arr=file("province.txt");// the txt file to be read
    // read the data from province.txt and write into 02_district.yml
    $myFile = "02_district.yml"; 
    //open a new file with name $myFile, if permission is dennied, throws message
    $fh = fopen($myFile, 'w') or die("can't open file");
    // write the head in YML file without backspace
    $head= "District:\n";
    fwrite($fh, $head);
    $i = 0;
    $k = 0;
    $tmp = "province";
    foreach($arr as $str)
    {
      $k++;
      // split $str, if digits were found
      list($province,$district)=preg_split("/[\d]+/", $str);;
      /*echo "<ul>";
      echo "<li>".$province;
      echo "<li>".$district;
      echo "</ul>";
      echo "<hr>";*/
    
      $district_id = "  District_".$k.":\n";// \n change line
      $district_name = "    name:  ".$district."";
      if($tmp != $province){//if province is changed, increase the id of province
    	  $i++;  
    	  $tmp = $province;
      }
      $province_id = "    province_id:  Province_".$i."\n";
      fwrite($fh, $district_id);//write the value in file
      fwrite($fh, $district_name);
      fwrite($fh, $province_id);
    }
    fclose($fh);
    
    ?> 
    
    // this is text file to be read by PHP script
    Nuristan	3001	Nuristan
    Nuristan	3002	Kamdesh
    Nuristan	3003	Waygal
    Nuristan	3004	Mandol
    Nuristan	3005	Bargi Matal
    Nuristan	3006	Wama
    Nuristan	3007	Du Ab
    Nuristan	3008	Nurgaram
    Sari Pul	3101	Sari Pul
    Sari Pul	3102	Sangcharak
    Sari Pul	3103	Kohistanat
    Sari Pul	3104	Balkhab
    Sari Pul	3105	Sozma Qala
    Sari Pul	3106	Sayyad
    Sari Pul	3107	Gosfandi
    

    copy | embed

    0 comments - tagged in  posted by toledot on Jan 28, 2010 at 2:05 p.m. EST
Sign up to create your own snipts, or login.