mah-skeet Posted October 21, 2008 Share Posted October 21, 2008 Hi, I am new to php. Can anyone tell me how/where the documentidentifier is set? I have a parser.php document that looks at $this->documentIdentifier which in turn is used to open a file. Thank you, Mark Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/ Share on other sites More sharing options...
rhodesa Posted October 21, 2008 Share Posted October 21, 2008 can you post the contents of parser.php? Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-670974 Share on other sites More sharing options...
wildteen88 Posted October 21, 2008 Share Posted October 21, 2008 Your question is not very clear. $this->documentIdentifier is not a predefined PHP variable. Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-670977 Share on other sites More sharing options...
mah-skeet Posted October 21, 2008 Author Share Posted October 21, 2008 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! Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-670985 Share on other sites More sharing options...
rhodesa Posted October 21, 2008 Share Posted October 21, 2008 right, but documentIdentifier is being set somewhere else in the file.... when posting code, wrap it in CODE tags by using the button with the # symbol on it...or attach the file use "Additional Options" Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-670988 Share on other sites More sharing options...
wildteen88 Posted October 21, 2008 Share Posted October 21, 2008 $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? Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-670991 Share on other sites More sharing options...
mah-skeet Posted October 21, 2008 Author Share Posted October 21, 2008 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!). Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-671010 Share on other sites More sharing options...
rhodesa Posted October 21, 2008 Share Posted October 21, 2008 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. Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-671019 Share on other sites More sharing options...
mah-skeet Posted October 21, 2008 Author Share Posted October 21, 2008 jeez...ok, I'll keep looking. I appreciate your help. Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-671025 Share on other sites More sharing options...
rhodesa Posted October 21, 2008 Share Posted October 21, 2008 if you want to learn more about Object Oriented Programming with PHP, give this tutorial a read through: http://devzone.zend.com/node/view/id/638 Link to comment https://forums.phpfreaks.com/topic/129415-where-does-this-documentidentifier-value-come-from/#findComment-671029 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.