-
Posts
638 -
Joined
-
Last visited
Community Answers
-
aaxc's post in Šis un tas. was marked as the answer
Ieliec viņus vienā divā un tam nodefinē klasi vai uztaisi JS eventu
-
aaxc's post in Vecums no personas koda was marked as the answer
Personas koda pirmās daļas 5 un 6 cipars norāda dzimšanas gadu pēdējos 2 ciparus.
Personas koda otrās daļas 1 cipars norāda gadsimtu, respektīvi 0 = 1800, 1 = 1900, 2 = 2000 utt
Tālāk jau pats drukā
-
aaxc's post in Foreach + xml was marked as the answer
Apmēram šādi, tik pārbaudi, vai nosaukums ir pareizais:
//Action if( $catfull != 'featured' ) { echo "<item>"; echo "<name>".$product_type." ".$name."</name>"; echo "<link>".$url."</link>"; echo "<price>".$price."</price>"; echo "<image>".$img."</image>"; echo "<category_full>".$catfull."</category_full>"; echo "<category_link>".$caturl."</category_link>"; echo "<in_stock>".(int)$qty."</in_stock>"; echo "</item>"; } -
aaxc's post in htaccess labošana no web. was marked as the answer
Kāpēc tu šādā veidā mēģini pārrakstīt .htaccess? To dara mazliet savādāk:
1. Uztais all-over rewrite:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> 2. Saglabā tos datus DB ( ar PHP varēsi easy pārbaudīt, lai dati nedublētos ):
short_urls: +---------+----+ | name | re | +---------+----+ | abcd123 | 1 | | useris | 2 | | markus | 3 | +---------+----+ 3. Ievadod http://lapa.lv/useris/ pārbaudi php līmenī urli un uzstādi attiecīgos parametrus, piemēram:
$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); $url = trim( $path, '/' ); $stmt = $db->prepare( "SELECT re FROM short_urls WHERE name = ?" ); $stmt->execute( array( $url ) ); $row = $stmt->fetch(); if ( $row ) { $_GET['re'] = $row['re']; } Šādi varēsi arī aliasus taisīt urļiem utt.
Tas tā, uz ātru roku.
-
aaxc's post in preg_match_all was marked as the answer
<?php $text = 'Lorem dolor [TOOLTIP]atsauce1[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP] sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus, sit amet tempor augue tempus vel. Mauris nec imperdiet mauris. Sed pharetra blandit justo at auctor. Quisque non laoreet sem. [TOOLTIP]atsauce[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP]'; preg_match_all("/\[TOOLTIP\](.*?)\[\/TOOLTIP\]/", $text, $matches); print '<pre>'; print_r($matches); print '</pre>'; ?>
-
aaxc's post in atdalīt ar komatu. was marked as the answer
$string = 's1, s2, s3, s4'; $array = explode( ',' , $string ); $output = "<select>"; foreach( $array as $value ) { $output .= "<option>{$value}</option>"; } $output .= "</select>"; echo $output;