We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15066
    • 27 Posts
    hmmm.... strangely, if I erase " or }, page works fine, but records are not written in other database - I think, plugin is automaticly disabled if there is such error...

    Second table is on same server, but in other database, separated...

    I don’t have any other ideas, so if anybody come up with idea, pls tell me smiley

    Plugin works fine, except that configuration page is opened when I save document.

    Here is the latest script
    ------------>
    $kopiraj = $_POST[’tvkopiraj_novico’]; / This is TV with options yes or no

    if ($kopiraj == ’yes’) {

    $link = mysql_connect("$server", "$dbase", "$pass") or die(mysql_error());
    mysql_select_db("$dbase", $link);


    $type = "document;
    $contentType = "text/html";
    $pagetitle = $_POST[’pagetitle’];
    $longtitle = $_POST[’longtitle’];
    $description = $_POST[’description’];
    $alias = $_POST[’alias’];
    $link_attributes = $_POST[’link_attributes’];
    $published = $_POST[’published’];
    $pub_date = $_POST[’pub_date’];
    $unpub_date = $_POST[’unpub_date’];
    $parent = $_POST[’parent’];
    $isfolder = $_POST[’isfolder’];
    $introtext = $_POST[’introtext’];
    $content = $_POST[’ta’];
    $richtext = $_POST[’richtext’];
    $template = ’16’; //id določi sam - configure manualy
    $menuindex = $_POST[’menuindex’];
    $searchable = $_POST[’searchable’];
    $cachable = $_POST[’cachable’];
    $createdby = $_POST[’createdby’];
    $createdon = $_POST[’createdon’];
    $editedby = $_POST[’editedby’];
    $editedon = $_POST[’editedon’];
    $deleted = $_POST[’deleted’];
    $deletedon = $_POST[’deletedon’];
    $deletedby = $_POST[’deletedby’];
    $publishedon = $_POST[’publishedon’];
    $publishedby = $_POST[’publishedby’];
    $menutitle = $_POST[’menutitle’];
    $donthit = $_POST[’donthit’];
    $haskeywords = $_POST[’haskeywords’];
    $hasmetatags = $_POST[’hasmetatags’];
    $privateweb = $_POST[’privateweb’];
    $privatemgr = $_POST[’privatemgr’];
    $content_dispo = $_POST[’content_dispo’];
    $hidemenu = $_POST[’hidemenu’];

    $sql_insert = "INSERT INTO modx_site_content (type, contentType, pagetitle, longtitle, description, alias, link_attributes, published, pub_date, unpub_date, parent, isfolder, introtext, content, richtext, template, menuindex, searchable, cacheable, createdby, createdon, editedby, editedon, deleted, deletedon, deletedby, publishedon, publishedby, menutitle, donthit, haskeywords, hasmetatags, privateweb, privatemgr, content_dispo, hidemenu) VALUES (’$type’, ’$contentType’, ’$pagetitle’, ’$longtitle’, ’$description’, ’$alias’, ’$link_attributes’, ’$published’, ’$pub_date’, ’$unpub_date’, ’$parent’, ’$isfolder’, ’$introtext’, ’$content’, ’$richtext’, ’$template’, ’$menuindex’, ’$searchable’, ’$cachable’, ’$createdby’, ’$createdon’, ’$editedby’, ’$editedon’, ’$deleted’, ’$deletedon’, ’$deletedby’, ’$publishedon’, ’$publishedby’, ’$menutitle’, ’$donthit’, ’$haskeywords’, ’$hasmetatags’, ’$privateweb’, ’$privatemgr’, ’$content_dispo’, ’$hidemenu’)";
    mysql_query($sql_insert, $link);

    mysql_close($link) ;


    }
    <---------------

      • 7231
      • 4,205 Posts
      Did you try adding the echo/exit after the first TV check? Maybe yes is not the value it is returning:


      echo $_POST[’tvkopiraj_novico’];
      exit;

      Then use the modx db api functions for the query: http://wiki.modxcms.com/index.php/API:DBAPI
      the db->query is most likely what you will want to use: http://wiki.modxcms.com/index.php/API:DBAPI:query
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 15066
        • 27 Posts
        lol... smiley it was very logical mistake...

        All works fine now ... TV works...

        I’ve just added this at the end of plugin


        $modx->db->connect();


        dev_cw, thank you for all your help...
          • 7231
          • 4,205 Posts
          Great, glad you got it working. I had never done this before so i learned something as well grin
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 15066
            • 27 Posts
            Hi!

            I have one more problem, that I didn’t saw it before...

            $createdon = $_POST[’createdon’]; - I need only this one
            $publishedon = $_POST[’publishedon’];
            $pub_date = $_POST[’pub_date’]; - Can be same as createdon

            date(’d-m-Y H:m:s’);

            And that would be the dates. How can I get them in this format 1233958645 ?

            Thank you!
              • 15066
              • 27 Posts
              I solved that one ...

              strtotime(’now’);



              But now I have another problem smiley

              How can I get alias ? It’s like that ... here-is-document-title

              Thanks
                • 15066
                • 27 Posts
                Solved