Kan na includen class niet aanroepen

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior, Medior and Junior SAP HANA Developer

Vacature details Vakgebied: Software/IT Opleiding: Medior Werklocatie: Veldhoven Vacature ID: 12696 Introductie Our client is the world's leading provider of lithography systems for the semiconductor industry, manufacturing complex machines that are critical to the production of integrated circuits or chips. Our purpose is “unlocking the potential of people and society by pushing technology to new limits”. We do this guided by the principles “Challenge”, “Collaborate” and “Care”. Wat verwachten we van jou? SAP Certified Application Associate - SAP HANA Cloud Modeling (training and/or certification) Bachelor degree or higher Excellent understanding of SAP HANA (2.0 / Cloud), Data Modelling and writing

Bekijk vacature »

Timen kut

Timen kut

12/03/2009 19:14:00
Quote Anchor link
Hello!
Ik heb een reactiesysteem die DMV ajax de reactie submit binnenin een div.

Diezelfde pagina wordt voor het submitten ook algebruikt om de reacties+formulier te tonen.

Als ik nu via een onclickevent de boel opnieuw inlaadt roept ie:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
Fatal error: Call to a member function getReacties() on a non-object in /var/www/vhosts/*****.nl/httpdocs/includes/reacties.php on line 10


Nu lijkt het mij omdat ik de class niet opnieuw aanroep. Als ik echter de class wel opnieuw aanroep krijg ik:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
Fatal error: Class 'Reacties' not found in /var/www/vhosts/*****.nl/httpdocs/includes/reacties.php on line 5


Dit is toch niet logisch, als ik voor de submit precies dezelfde pagina al inlaadt, en dat ie 't dan wel doet?:D
Gewijzigd op 01/01/1970 01:00:00 door Timen kut
 
PHP hulp

PHP hulp

30/04/2024 05:38:51
 
Jesper Diovo

Jesper Diovo

12/03/2009 19:32:00
Quote Anchor link
En als je hem opnieuw include (die class)?
 
Timen kut

Timen kut

12/03/2009 19:42:00
Quote Anchor link
begint ie te miepen dat ik Connect(); niet mag aanroepen
Omdat het een include is, wordt die ook gewoon geinclude enz. alleen hij ziet dat anders blijkbaar :-p

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
Fatal error: Cannot redeclare class Connect in /var/www/vhosts/*****.nl/httpdocs/classes.php on line 2
Gewijzigd op 01/01/1970 01:00:00 door Timen kut
 
Jesper Diovo

Jesper Diovo

12/03/2009 19:49:00
Quote Anchor link
Hm.. Heb je misschien een voorbeeldje, dat we iets minder in het duister tasten? :-)
 
Timen kut

Timen kut

12/03/2009 19:54:00
Quote Anchor link
heb wel een voorbeeld maar die is f-ing huge...

het komt erop neer dat ik een textarea heb voor het reageren..
Mijn submit is een button met de id "reactieClick"
dmv jquery wordt het scriptje gebruikt:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$(document).ready(function(){
    $("#reactieClick").click(function(){
        var str = $("#react").serialize();
        $.ajax({
        type: "POST",
        url: "includes/reacties.php?page2=<?=$_GET['page2']?>",
        data: str,
        success: function(msg){
            result = msg;
            $("#toonreacties").html(result);
        }
    });
    return false;
    });
});

maar voordat ie submit include ie zelf ook al reacties.php zodat men de reacties al wel lezen kan voor hij besluit te reageren.

Dus zodra ik op de button click wordt AJAX ding ingeladen, verstuurd de waarde naar reacties.php en dan gaat ie whinen.

De div wordt dus ook wel opnieuw ingeladen, maar dan dus met de verse error report ipv de reacties :P
Gewijzigd op 01/01/1970 01:00:00 door Timen kut
 
Jesper Diovo

Jesper Diovo

12/03/2009 19:55:00
Quote Anchor link
En hoe ziet reacties.php er een beetje uit?
 
Timen kut

Timen kut

12/03/2009 19:57:00
Quote Anchor link
In reacties worden de reacties getoond en wordt bij een submit een nieuwe reactie geplaatst, met onderin de form.

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
    if(isset($_POST['submitreactie'])){
        $reacties->addReactie($_POST);
    }

    $leesreacties = $reacties->getReacties($_GET['page2']);
    if(!empty($leesreacties)){
    echo '<br /><br /><h1>REACTIES</h1><br /><br />';
        foreach($leesreacties as $l){
        $avatar = (!empty($l['avatar']))? "uploads/avatar/".$l['avatar'] : "avatar.png";
        $zegt = (empty($l['zegt']))? "zegt" : $l['zegt'];
        $xpl = explode(' ', $l['datum']);
        $datum = $xpl[0];
        $tijd = $xpl[1];
            echo '
                <div class="kliko">
                    <div class="avatar"><img src="'
.$avatar.'" width="50" alt="" /></div>
                    <div class="reactions">
                        <div class="naam">'
.ucfirst($l['username']).' '.$zegt.':</div>
                        '
.stripslashes(nl2br($l['message'])).'<br /><br />
                        Op <strong>'
.$datum.'</strong> om <strong>'.$tijd.'</strong><br /><br />
                    </div>
                </div>'
;
            }
    }

  
    if(!empty($_SESSION['userID']) && !empty($_SESSION['username']) && !empty($_SESSION['name'])){
        echo '
        <div class="reactiegeven">
            <div style="background:url(\'images/reageer.png\'); width:111px; height:28px; float:right; margin-bottom:10px;"></div>
            <form action="" method="post" style="margin:15px;" id="reactieformpje">
                <textarea name="bericht" cols="0" rows="0" id="react"></textarea>
                <input type="hidden" name="newsID" value="'
.$nieuwsID.'" />
                <input type="button" id="reactieClick" name="submitreactie" class="loginsub" value="" style="width:43px;height:22px;background:url(\'../images/submitgo.png\');border:0pt;margin-left:250px; *margin-top:-1px;" />
            </form>
        </div>
        '
;
    }


?>
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.