Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 258 van 286

Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dan mag een ander zich hierover buigen. Ik weet het dan ook niet meer.
Ik ben meer bevriend met Multiviews wat makkelijker en minder foutgevoeliger werkt.
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Aarclay schreef:
Dan mag een ander zich hierover buigen. Ik weet het dan ook niet meer.
Ik ben meer bevriend met Multiviews wat makkelijker en minder foutgevoeliger werkt.
Kan ik dat niet gebruiken/
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ja, een kwestie van $_SERVER[REQUEST_URI] uitpluizen en exploden op / in PHP. En MultiViews in htaccess aanzetten.

Genoeg documentatie etc op het wereldwijde web.
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Marvin, je wilt dus alles achter de slash linken naar je index?

Kan je zo doen, heb ik ook gedaan in mijn CMS wink
RewriteEngine On
RewriteBase /
ErrorDocument 404 /404

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?page=$1

Options +FollowSymLinks +MultiViews


Zo werkt het op mijn CMS, als een pagina zo bestaat (voorbeeld: contact.php) en je doet site.nl/contact gaat hij naar contact.php en niet naar index.php?page=contact
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Thanx milan! Het werkt!
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Bestaat er zo programma met waar mee je kan zien welke IP / web pagina een programma laad?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Kan je met Wireshark doen.
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik heb bij weebly een domein gekregen maar heb de nameservers veranderd,
hij deed het
maar toen ik bestande uploaden niet meer,
domein: Weexhosting.nl
Doet hij het bij jullie ook niet?

EDIT

laatmaar hij werkt
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe kan ik met mijn database class makkelijk en goed in andere classes werken?
Met extends is het niet handig.

Dus hoe doen jullie dit??
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Met extend is het niet correct....
Je kan toch een include in je bootstrap doen, en dan een instance maken?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Freestyle schreef:
Hoe kan ik met mijn database class makkelijk en goed in andere classes werken?
Met extends is het niet handig.

Dus hoe doen jullie dit??
Dependency injection...
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hmm ik ben er naar opzoek en ik probeer het uit maar het wilt nog niet bepaald lukken.

Code:

Database.php
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] database [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$connection[/COLOR][COLOR= #007700];[/COLOR]
    
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] __construct[COLOR= #007700]([/COLOR][COLOR= #0000BB]$host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$user[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$database[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$user[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]) {[/COLOR]
            [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$database[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selectDb[/COLOR][COLOR= #007700]) {[/COLOR]
                [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection[COLOR= #007700];
            }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Couldnt select to database table"[/COLOR][COLOR= #007700];
            }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Couldnt connect to Database"[/COLOR][COLOR= #007700];
        }
    }[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [URL="http://www.php.net/static"]static[/URL] [COLOR= #007700]function[/COLOR] getInstance[COLOR= #007700]() {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection [COLOR= #007700]==[/COLOR] NULL[COLOR= #007700]) {[/COLOR]
            [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection[COLOR= #007700];[/COLOR][COLOR= #FF8000]// init your database connection[/COLOR]
        [COLOR= #007700]}[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]connection[COLOR= #007700];
    }
}[/COLOR]
Mijn builder:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] builder [COLOR= #007700]{[/COLOR]

    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$get[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$root[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]pages/[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$ext[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000].php[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$error404[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$_db[/COLOR][COLOR= #007700];[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] __construct[COLOR= #007700]([/COLOR][COLOR= #0000BB]$get[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$root[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ext[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700](),[/COLOR] [COLOR= #0000BB]$error404[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]404[/COLOR][COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/global"]global[/URL] [COLOR= #0000BB]$db[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]_db [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$db[/COLOR][COLOR= #007700]->[/COLOR]getInstance[COLOR= #007700]();[/COLOR]
        
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]error404 [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$error404[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ext[/COLOR][COLOR= #007700]))[/COLOR]     [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]ext [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$ext[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$root[/COLOR][COLOR= #007700]))[/COLOR]    [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]root [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$root[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/is_array"]is_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700]))[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]forbidden [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/is_array"]is_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700]))[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]forbidden [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$forbidden[/COLOR][COLOR= #007700];[/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= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]get [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$get[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]get [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"home"[/COLOR][COLOR= #007700];
        }
        
    }
}[/COLOR]
Ik krijg nu als error:

Couldnt connect to Database
Fatal error: Using $this when not in object context in /home/admin/domains/marijnkok.nl/public_html/v3/lib/classes/database.php on line 28


Weet iemand wat ik nu dan fout doe?
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Wat is overzichtelijker?

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
SELECT        *
FROM        users
WHERE        lid = 377
"[/COLOR][COLOR= #007700]);[/COLOR] 
?>

[COLOR= #0000BB]<?php[/COLOR] 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE lid = 377"[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Lennard

Lid · Topicstarter

Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Wat vind je zelf? yummie
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren