Jump to content
php.lv forumi

Filmam.lv


eT`

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

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 by eT`
Link to comment
Share on other sites

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ā ^^

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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ā');
?>

Link to comment
Share on other sites

ā 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 by eT`
Link to comment
Share on other sites

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 by eT`
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...