Jump to content

where does $this->documentIdentifier value come from


mah-skeet

Recommended Posts

Sorry wildteen88, I thought it some sort of builtin. 

 

Rhodesa,

 

Here is one function from the parser that looks for documentIdentifier...the entire page is way too big to post all of the code.

 

    function postProcess() {

        // if the current document was generated, cache it!

        if ($this->documentGenerated == 1 && $this->documentObject['cacheable'] == 1 && $this->documentObject['type'] == 'document' && $this->documentObject['published'] == 1) {

            $basepath= $this->config["base_path"] . "assets/cache";

            // invoke OnBeforeSaveWebPageCache event

            $this->invokeEvent("OnBeforeSaveWebPageCache");

            if ($fp= @ fopen($basepath . "/docid_" . $this->documentIdentifier . ".pageCache.php", "w")) {

                // get and store document groups inside document object. Document groups will be used to check security on cache pages

                $sql= "SELECT document_group FROM " . $this->getFullTableName("document_groups") . " WHERE document='" . $this->documentIdentifier . "'";

                $docGroups= $this->db->getColumn("document_group", $sql);

 

// Attach Document Groups and Scripts

if (is_array($docGroups)) $this->documentObject['__MODxDocGroups__'] = implode(",", $docGroups);

 

                $docObjSerial= serialize($this->documentObject);

                $cacheContent= $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;

                fputs($fp, "<?php die('Unauthorized access.'); ?>$cacheContent");

                fclose($fp);

            }

        }

 

        // Useful for example to external page counters/stats packages

        if ($this->config['track_visitors'] == 1) {

            $this->invokeEvent('OnWebPageComplete');

        }

        // end post processing

    }

 

As you can see, it concatenates /docid_#.pageCache.php.  I have several different documents in this folder...ie.  docid_1.pageCache.php, docid_13.pageCache.php, etc.

 

Thanks for the help!

$this->documentIdentifier is most probably set earlier on in your class, perhaps in your classes constructor. Or after the object is initiated. We cant tell by looking at a single method we must see the class as a whole.

 

Why do you want to know where the $this->documentIdentifiervariable is being set?

Hi guys...thanks again for the help.  I've searched the entire website and I've found the following lines of code where documentIdentifier is used.  In addition to the code I've already provided...I found the following:

 

1)  #if ($showCrumbsAtHome || (!$showCrumbsAtHome && ($modx->documentIdentifier != $modx->config[\'site_start\'])) ){#

 

2)  #if ($showHomeCrumb && ($modx->documentIdentifier != $modx->config[\'site_start\'])){#

 

3) #        $sql .= "LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '" . $this->documentIdentifier . "' ";#

 

I guess I ask this question for my own interest of trying to figure out how this website (and php) works.  I'm a Javascript/VBScript/ASP.NET guy, but I've been tasked with making changes to a php website (lucky me!).

i should also note, the value of that variable can be elsewhere too. a script that uses this class can initiate and instance of the parse object, set the value of documentIdentifier, and then run the postProcess() method.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.