Aarclay schreef:Eerdere citaten tonen
Bartv schreef:Eerdere citaten tonen
Aarclay schreef:Eerdere citaten tonen
Jessee schreef:Dus Nederlanders op vakantie of die in het buitenland wonen mogen niet op je website?
Wanneer leren mensen nou eens dat dingen beperken gewoon niet kan. Los dingen op een betere manier op, niet half en daarmee ook nog users beperken.
Het is inderdaad het beperken van registraties, en Tweakers doet dat overigens ook. Waarom zou een Nederlands iemand uit Polen zich opeens willen aanmelden op onze website? Laat ze dan gewoon een VPN gebruiken, en ik denk dat velen ge-emigreerden/lange vakantiegangers dat ook wel zullen doen.
Even wat anders: waarop ik vastloop.
Ik wil de reviews op mijn site gaan splitten in losse paginas. Daarbij wil ik de content splitten over meerdere pagina met behulp van een [page] tag:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]( ![/COLOR][URL="http://www.php.net/isset"]isset[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] ) || ![/COLOR][URL="http://www.php.net/is_numeric"]is_numeric[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] ) )
{[/COLOR]
[COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]||[/COLOR] [COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] >[/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$arrBericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000][page][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$strBericht[/COLOR] [COLOR= #007700]) ) )
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Deze pagina bestaat niet. Ga terug."[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$arrBericht[/COLOR] [COLOR= #007700][([/COLOR] [COLOR= #0000BB]$_GET[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] -[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700])] ;
}[/COLOR]
?>
En het overzicht:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/for"]for[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$int[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$int[/COLOR] [COLOR= #007700]< ([/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$arrBericht[/COLOR] [COLOR= #007700]) +[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$int[/COLOR][COLOR= #007700]++ )
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<a href=/review/"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"&page="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$int[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]">"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$int[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" </a>"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Maar nu zou ik graag titels plaatsen in de page-tag. Zoals [page="Geschiedenis"] waarbij in het overzicht ook daadwerkelijk Geschiedenis als titel is te zien. Hoe valt dit aan te pakken? Ben zelf geen koning in reg-exes, en loop even vast hoe ik dit kan implementeren.
Ik snap je precieze probleem niet. Wat wil je precies bereiken met de code?
Een artikel splitsen over meerdere paginas.
Enig idee? Zoiets als dit....
https://tweakers.net/reviews/331/tweakers-faq.html en dan de inhoudsopgave.
Waarschijnlijk is dat gewoon iets als
Article
- Id (311)
- Title (Tweakers faq)
Pages
- Id (xxxx)
- Article_id (311)
- Title (Algemeen)
- Article_order (1)
- Content (....)
En wat je dan kan doen in gewoon voor het artikel met het ID in de url (in dit geval 311) de pages ophalen. En dan loop je over elke page heen.
Voor de inhoudsopgave hoef je dan alleen zoiets te doen (pseudocode):
[COLOR= #0000BB]<?php
$pages[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT Title, Article_order FROM Pages WHERE Article_Id = 311 ORDER BY Article_order DESC"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pages[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$page[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="/311/{$page->id}">{$page->title}</a>[/COLOR][COLOR= #007700];
}[/COLOR]
En om de content op te halen van bijvoorbeeld pagina 2 hoef je dan alleen zoiets te doen (wederom pseudocode):
[COLOR= #0000BB]<?php
$article[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT a.Title, p.Title as pageTitle, p.Content FROM Article a LEFT JOIN Pages p ON a.Id = p.Article_id WHERE a.Id = 311 AND p.Article_order = 2 ORDER BY Article_order DESC"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<h1>{$article->Title}: {$article->pageTitle}</h1>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p>{$article->Content}</p>[/COLOR][COLOR= #007700];[/COLOR]
Maar hoe het precies in jouw code moet, is natuurlijk lastig te zeggen met alleen een stukje pagination-script.