Jump to content

thomas

Members
  • Posts

    196
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by thomas

  1. Hi Diogo, one change was neccessary: if($tagPage instanceof NullPage) { ... } Other than that, spot on! Thanks! -t
  2. Hi everyone, is it possible to edit the "created" field of a page I create via the API? I tried $page->created = '2011-03-23 16:37:07'; as well as inserting a Unix timestamp but "created" is always "now" ... (Background: I'm getting page data from an external server and to keep this sorted right with all the other pages (like in search results) I don't want to use a custom date field.) Thanks, thomas
  3. Hi Diogo, seems easy enough! I couldn't quite get it work yet but I'm positive I'll figure it out sooner or later. Thanks, thomas
  4. Hello Everyone, I'm working on a module that pulls a JSON list of videos of a server and creates a page for each video. These videos come with several tags and I would like to include them. My plan is as follows: - Create a page for the video with the neccessary data - Seperate the tags for each video - Check for each tag if a page with that title exists under /tags/ - if not, create it - add that page to the "tags" field of the video page. It's the last part that I can't figure out. Could you explain to me how to add a page to a field in an existing page via the API? Thanks, thomas
  5. I just used this for my search question (http://processwire.com/talk/topic/1561-search-fieldtype-pages/) and it works great. Thanks!
  6. Hello, I am going to resurrect this old post to share my "related pages" approach. It uses the described pages-as-tags and then looks for pages with the same tags. The more tags are shared, the more "related" the other page is, thus getting it further up on the list. foreach($page->tags as $tags) { $tag = $sanitizer->selectorValue($tags->title); $related_pages = $pages->find("tags.title=$tag"); foreach($related_pages as $related) { if($related->id != $page->id) $related_id[$related->id]++; } } arsort($related_id); foreach($related_id as $key => $val){ $rp = $pages->get($key); ?> <a href="<?=$rp->url;?>"><?=$rp->title;?><br><? } I just translated this to PW from a Perl module I had, so please feel free to correct my PW syntax since I'm new to this. Thanks, thomas
  7. Thanks for the hint! I keep forgetting those pages stored in the fieldtype "pages" are just pages ...
  8. Hello, I am bulding a site that uses the "Pages" fieldtype for categories and tags. Now I'd like to include this information in the search. Can I search the pages fieldtype without iterating over each page? Like if someone searches for "news", it finds any page where the field "tags" contains the page with the title "news"? Thanks! thomas
  9. Hello Ryan, thanks for the quick reply. That's pretty much what I did (I have a module pulling JSON data of the video server). My error was, that 'video_image' was a text field and not an image field! Thanks for the great work, thomas
  10. Hello everyone, I'm new to Process Wire and I'm trying to set up a website for a magazine. My first task was to import a bunch of videos from another site into PW and it actually worked out quite good. Now I've got a bunch of pages with an external image reference in the image field. My idea was *not* to copy the whole lot of images, but to download and resize the ones that are requested. The first naiive attempt was this: <img src="<?=$article->video_image->size(350,88)->url; ?>"> With 'video_image' being a full path to an image on another remote server. Soo ... that didn't work. Do I need to copy the image to my server before resizing it? Or is there a trick to resize it and save only the "new" image on my server? Thanks for any help! Loving PW so far! thomas
×
×
  • Create New...