Jump to content

winston

Members
  • Posts

    8
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://winstonclose.com

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

2,210 profile views

winston's Achievements

Newbie

Newbie (2/6)

13

Reputation

  1. Oops. Fixed. That was a problem for chapters 7 and 5 only. I'm surprised the authors didn't complain. Thanks!
  2. http://visualizingmodernchina.org The Visualizing Modern China web site is the online companion to an academic book by the same name. The web site presents images beyond what would have been economical to print. The pages are pregenerated. ProcessWire is on a different domain on the same server. (You will have to trust that ProcessWire is involved, because there is little evidence of it!) I used the CropImage module. Images are stored in the usual place in ProcessWire, then copied to the /images directory when a page is viewed or generated in PW.
  3. Thanks, Adrian. The new notifications system will be interesting, but in the meantime I took a break, then found what I was looking for in Notices.php. The answer is: $this->message("This message contains <a href=''>a link</a>", Notice::allowMarkup); The code from Notices.php couldn't be clearer: /** * Flag indicates the notice is allowed to contain markup and won't be automatically entity encoded * * Note: entity encoding is done by the admin theme at output time. * */ const allowMarkup = 32; /** * Create the Notice * * @param string $text * @param int $flags * */ public function __construct($text, $flags = 0) { $this->set('text', $text); $this->set('class', ''); $this->set('timestamp', time()); $this->set('flags', $flags); }
  4. I used to be able to include a link in module messages, like this: $this->message("Page <a href='$url'>$title</a> generated"); In recent versions, the message gets the htmlspecialchars treatment before output, and the link doesn't work. I tried looking but couldn't find where the messages get output formatted. Thanks for your help!
  5. Thanks, Joss, I will try the repeater field. Yes, I wanted to use the API functions to resize etc. I definitely wanted to input the images via drag-and-drop. So I kept the /assets/files/<pageno> structure, but copied the files to the more descriptive URLs when I generated the page. In the original post, I made an 800-pixel copy of the image, then copied it to the images directory. I like to pre-generate pages, and I keep a separate static copy of the page, so why not a separate public-facing copy of the image? PW's caching isn't needed once the image is outside PW's structure; Apache just serves it. (Same goes for the pre-generated pages. No cache needed, but you have to remember to generate.)
  6. I have avoided using the /assets/files/<pageid>/ directories because I don't like the resulting URLs. I have been copying the images as I reference them to a more descriptive location. Crude but effective: $im = $page->images->first(); $fn = $im->basename; $image_url = "/comix/{$artist->name}/$fn"; $image_fn = $_SERVER["DOCUMENT_ROOT"].$image_url; if (!file_exists($image_fn)) { $of = $im->width(800)->filename; print "<br>Production file doesn't exist, making a copy"; print "<br>Copy "; print copy($of, $image_fn) ? "successful" : "failed"; } What I was looking for when I found this was a way to assign images other data fields, which Joss also talks about in the original post. I want to use the uploading and image storage features of PW, but each image needs more data than just Caption. It needs source, Figure number, blah blah. I have been reading around on it, and noticed that there is something called $image->page(). Is there an internal template I could change? Or is there some capability already built in that I haven't tried? I will be looking into it further but would appreciate any pointers. Thanks!
  7. Thanks, and sorry for not getting back to this thread sooner. Jonathan's suggestion worked, and Ryan's reply was enlightening. I had a feeling ignorance was the problem. Obviously I had some catching up to do on PHP namespaces. I also had a nagging feeling of what Ryan said, that you are better off avoiding globals. Eventually I rewrote the code to avoid them. Thanks again for your help. I am new to this community, and relatively new to Processwire, and I am very impressed by both.
  8. Hello, I am having trouble with the "global" keyword used in templates. What am I missing? Something obvious, probably. Make this into a file and put it in the template directory: <? $cd = "this is a test"; roo(); function roo() { global $cd; print "[".$cd."]"; } It works if you run it from the command line (using php -f), but the $cd variable is not passed when the file is used as a template - it just prints the brackets. Thanks for your help! Winston
×
×
  • Create New...