Re: SetProperty question
Michael Eager <[email protected]> Fri, 11 Apr 2025 10:17:34 -0700
| Newsgroups | gmane.comp.web.wiki.pmwiki.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks. It looks like the problem was in handling the results of ParseArgs() on the options to (:pdfthumb:). I might look at using page variables instead of the this markup. On 4/9/25 11:10 PM, Petko Yotov wrote: > Your description of SetProperty() is correct. > > SetProperty($pagename, $propname, $propvalue) adds or replaces a > temporary value in the global array $PCache[$pagename][$propname]. > > PageTextVariable($pagename, $propname) indeed retrieves the stored > value, but it also returns page text variables, these are variables > written in the page text like this: > > Name:value > (:AnotherVarName:Some value:) > > If it is not returning what you expect, check if in the page there is a > text variable with the same name as the property that overwrites your > property. If this may happen, you could use a custom property name that > does not look like a page text variable, for example prefix it like > "pdfthumb:size" (a core PTV name cannot have a colon). > > Or, check if you are trying to retrieve the value in one function before > the other function sets it. Your 2 markups need to be processed in the > correct order. > > Petko > > > On 10/04/2025 03:20, Michael Eager wrote: >> I've been fixing bugs with the PDFThumb cookbook script I wrote >> several years ago. PDFThumb generates a thumbnail of a PDF file >> and displays it with a caption and a link to the file. >> >> The script implements two markups: (:pdfthumb:) overrides global >> parameters for the page, such as the size of the generated thumbnail. >> (:pdf:) generates a thumbnail if it doesn't exist, and displays the >> thumbnail with a link and caption. >> >> In (:pdfthumb:) I used SetProperty to save the parameters for the >> page. It appears to me that key/value pairs are saved for the >> specified pagename. In (:pdf:) I use these values, if set, or the >> default values. >> >> I had thought that PageTextVar() retrieved the key/value pair for >> the specified page, but that does not appear to be the case. >> >> Do I understand SetProperty() correctly? How are values supposed >> to be retrieved? > -- Michael Eager _______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users