2easy Posted January 27, 2010 Report Share Posted January 27, 2010 ar to NaturalId tu ķip domāji Lauks - id,natid,name = 1,fantastikas-filmas,Fantastikas filmas un visām tabulām kurā šito verķi likšu tā darīt hmm neliekas tik grūti ... yep, tieši tā amm par to WHERE title = 'parveidots no mod rewrite saņemtais $_GET[id]' varētu būt šitā? $titlis = ucfirst(str_replace("-"," ",$_GET["title"])); WHERE title = '$titlis' šitā pat vieglāk būtu izdarīt :)) mmm... par šo ieminējos drīzāk kā par fancy alternatīvu. normāli ja vajag natural id, tad tā arī lieto real natural id. vismaz tas strādās universāli kas ar UTF-8 čariem? tas nekas, ka viņi urlī ir? man viņi nepatīk :D vo to nemāku noņemt :/ utf8 strādās http://php.lv/f/topic/15481-isti-nav-saistibas-ar-php/ taču iesaku palikt pie ascii (tur tālāk ir vēl piemēri, kā aizvietot) http://php.lv/f/topic/15423-noderigas-funkcijas/page__view__findpost__p__118603 es tur pačekoju bet ar SEO nekad neesmu ņēmies, tāpēc man tā ir tumša bilde, kas ko tur dara utt. http://www.google.com/support/webmasters/bin/answer.py?answer=35769 Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) tāmmm es tagad izmēģināju un man tiem kam nav UTF-8 darbojas viss. tālāk jāpieliek šī f-ja laikam function seo_string($string, $len = 10, $seperator = '-') { $string = str_replace(array("ş", "Ş", "Ţ", "ţ", "ă", "î", "â"), array("s", "s", "t", "t", "a", "i", "a"), $string); //RO translit $string = str_replace(array("ā","č", "ē", "ģ", "ķ", "ļ", "ī", "ū", "š", "ņ", "ž"), array("a", "c", "e", "g", "k", "l", "i", "u", "s", "n", "z"), $string); //LV translit $string = str_replace(array("Ā","Č", "Ē", "Ģ", "Ķ", "Ļ", "Ī", "Ū", "Š", "Ņ", "Ž"), array("A", "C", "E", "G", "K", "L", "I", "U", "S", "N", "Z"), $string); //LV translit CAPS LOCK $string = str_replace(array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы"),array("JO","ZH","CH","SH","SCH","JE","JY","JA","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","'","y"), $string); //RU translit $string = strtolower($string); $string = trim($string); $string = trim(@ereg_replace("[^ A-Za-z0-9_]", " ", $string)); #$string = ereg_replace("[ tnr]+", "-", $string); $string = str_replace(" ", $seperator, $string); $string = @ereg_replace("[ -]+", "-", $string); $t = explode($seperator, $string); if(count($t)>$len) { $out = array_slice($t, 0, $len); $string = implode($seperator, $out); }; return $string; }; gan tur kur padod urli, gan tur kur nolasa. bet emm tur kur padod urli viņš pārveidos uz parastajiem bet kā šito visu inversi uztaisīt? ne jau vēl vienu f-ju ar apmainītām vietām :/ EDIT: vienā virzienā aizgāja tagad jāizštuko kā izdarīt lai attēlo tās sadaļas kurās ir garumzīmes :/ EDIT2: nezinu kapēc bet aizgāja arī otrādi :D EDIT3: aizgāja, bet ne tiem, kam Š wtf :D āēīū iet :D Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 runajot par seo es parasti lietoju vv Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?path=$1 [L,QSA] yep, tas ir vispārīgais variants. un arī ieteicamais. es šoreiz sāku ar vienkāršāku piemēru, jo eT` jau pats teica, ka vēl nav izpratis mod_rewrite. protams, ka labāk web applikāciju ir taisīt centralizēti caur index.php. bet sākumā, kamēr vēl mācās, tikmēr daudzi taisa atsevišķus failus, tā vietā lai tos vnk inkludotu iekš index.php kkad agrāk jau rakstīju par mod_rewrite http://php.lv/f/topic/14841-aprejamais-gabals/page__view__findpost__p__114662 taču laikam pārāk sarežģīti toreiz skaidroju, un tie ieteikumi netika izmantoti praksē. vismaz šobrīd tajā lapā vēl nav ieviests mod_rewrite. redzēs kā būs šajā gadījumā ^^ Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 vienā virzienā aizgāja tagad jāizštuko kā izdarīt lai attēlo tās sadaļas kurās ir garumzīmes :/ inversi nevajag. tā ir vienvirziena biļete dabū natural id un use it. thats it vai nu adresē liec abus id, vai arī tabulā ievies vēl vienu lauku priekš otra id Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 27, 2010 Report Share Posted January 27, 2010 es ieteiktu to seo nedaudz vienkaršāku <? function str2seo($str){ $a = array('/ā/','/č/','/ē/','/ģ/','/ī/','/ķ/','/ļ/','/ņ/','/ō/','/ŗ/','/š/','/ū/','/ž/','/ /'); $b = array('a','c','e','g','i','k','l','n','o','r','s','u','z','-'); $str = preg_replace($a,$b,$str); return $str; } echo str2seo('āķis kakā'); ?> Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 Labi, maukšu tad tabulās otru ar varcharu un to pārveidoto nosaukumu :) Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 27, 2010 Report Share Posted January 27, 2010 varetu mysql.com iedot ieteikumu lai blakus varcharam uztaisa seofriendly :P Type: SeoFriendly Size: 50 Value: "Ušakovs iesper Kalvītim" select value from seo_table where id=1; -> usakovs-iesper-kalvitim :) Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 tamm ar galveno žanru lapu viss aizgāja ( seoid uzmaucu ) bet emm man tur pagination sistēma un links apm. tāds zhanri/fantastikas-filmas&p=2 , bet viņš parāda, ka tāds lniks neeksistē. atkal htaccess? Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 27, 2010 Report Share Posted January 27, 2010 ja tu lieto htaccess tad atceries & nevajag likt ka pirmo :) sac drosi tak ar ? .lv/seo/urla?get=parametrs Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) tammm man tagad ir ar ? man tas & bija jo vislaik biji 2 parametri. bet parada - http://filma.lv/zhanri/fantastikas-filmas?p=2 paskaties ;]] man htaccessā neko jaunu nevajag? EDIT: bet šeit - http://filmam.lv/filmas/ darbojas :/ Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 izlasi ko es rakstīju par [QSA] pašā sākumā Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) ā nu ok, viņš padod arī pārējos. tas ta ka skaidrs. bet man adresi filma?p=2 padod bet zhanri/fantastikas-filmas?p=2 nepadod EDIT: abiem pagination f-ja viena un tā pati tikai atšķiras, ka filma ir viens parametrs ( /filma?p=2 bet zhanri ir 2 ( /zhanri/name?p=2 ) EDIT2: atradu kļūdu viss ok, tagad :) Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 (edited) nepadod ko? id=fantastikas-filmas vai p=2? Edited January 27, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 nē, nē viss ok, tagad :) visu padod :) Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) BUMP! visur tomēr man nesanāk. man ir TV sadaļa un pirmstam links bija - index.php?lapa=viewtv&id=$id , bet tgad uzliku /viewtv/$seoid, bet mani pārmet uz indexu ( it kā nebūtu switchā nodefinēts ) un tālāk arī nestrāda sērijas links kādreiz ( index.php?lapa=episode?tvid=$tvid&id=$id ) tagad ( episode/supernatural/wendigo ) Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.