Jump to content

Search the Community

Showing results for tags 'Api'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hello, I have a strange problem here. Long story: - I added an Image field to my user template - On my page I have a little login box in a sidebar, which is displayed whenever the current user isn't guest. It the checks if the user has an image uploaded: <?php if($user->image->url):?> <img src="<?=$user->image->size(60,60)->url;?>" style="float:right;"> <?php endif;?> This works. Now to the strange part: In the main content of the page I want to display a profile page for any givven user registered. I took this approach from Ryan's BlogProfile: $name = $sanitizer->pageName($input->urlSegment1); $profile = $users->get($name); <?php if($profile->image->url):?> <img src="<?=$profile->image->size(100,100)->url;?>" style="float:left;margin-right:10px;"> <?php endif;?> This is on the same page as the login box. Now I'm getting very strange results. Checking if a file is uploaded constantly fails, so I get errors when there's no image. It's hard to explain and my only two explanations are I'm either stupid or there's something I need to know about images in a user object, or getting info from $users. Sorry for the weak explanation, can someone help me out? Thanks, thomas
  2. Hello, still trying to understand everything ... I have an array of page IDs, now I want to push the pages with those IDs into a wireArray to use the PW methods on it, like limit and sort. How can I create a new wireArray to hold those pages? I tried $rp = $pages->makeNew(); but get an error ("Error Exception: Method Pages::makeNew does not exist or is not callable in this context") Thanks for help! thomas
  3. 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
  4. 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
  5. First of all, my congratulations to Ryan on this amazing piece of software! This is my first post in these forums, but I have been a silent noob for a few months, learning while using processwire for every web project in the Multimedia Design course I'm currently finishing! On to the bug/problem (is this the right place for this post?) : When I try to sort a PageArray object using the $a->sort() method on a string field, say, the title, the API places the ones starting with uppercase first, and the lowercase last, like so: A,B,C,D,a,b,c,d... Am I doing something wrong/missing something? Cheers, Tiago
  6. Hi guys! I want to import into multiple pages at once the same value of the field, which is Pagefield. I make a selection of pages, and how to specify the page in Pagefield do not know. Likely this question already rose, but at a forum I didn't find the answer. Example: Pagefield is called «subway_station» in it I have to choose two out of a hundred pages, called «green» and «orange», as it be? foreach($pages->get("/district/")->find("district_region=UZAO") as $p) { echo "<a href='{$p->url}'>{$p->title}</a> " ; $p->subway_station->add("/subway_station/sub_st_0111/"); // $p->save(); }
  7. While developing my dashboard module I came across a lot of difficulties when building a configurable filter for selecting pages for the last pages widget. Some things I discovered: "or" filter in native page fields didn't work. Fixed by Ryan in the last commit (Big thanks!): https://github.com/ryancramerdesign/ProcessWire/commit/70093241b2cbfe7cae79f28531c1a5df1a572169 It is was somehow difficult/impossible to use get('/')->find(...). This resulted in weird results where direct children were not in the results array. Should also be fixed (not tested). There is an undocumented selector "has_parent" which looks for a parent up to the root. Quite handy! So "has_parent!=2" removes all admin pages (except admin itself, add id!=2 for that) from a select (thanks @Soma!). The "user" which created the standard pages is not the superuser. This was the reason I doubted my results because I thought the superuser would have created everything. Me stupid. The inputFieldSubmitButton module generates a button which gets doubled in the admin head section. Couldn't find the place where this happens until I found out that this is generated with Javascript. Me stupid again. Important rule for selectors: First "has_parent" (if needed), second "include=all" (if needed), then the other filters. And in the end "sort" and then "limit". Not sure about this, but this works for me, so I have only one selector which seems to be correct. For example the latest pages for a specific user which are not admin pages (and no trash): has_parent!=2,id!=2|7,include=all,created_users_id|modified_users_id=41,sort=-modified,limit=10 Looks easy, but wasn't (at least for me)
  8. I've been working on an automating an import of some pages. For all intents and purposes, it's basically a form submission to a module process that creates/updates a page of a certain template. For the literal minded, I'm importing an existing news archive (headline, story, byline, image) by scripting the form submission. So far, everything has worked great, and I can update the text/textarea fields without any issues, but I'm not able to figure out how to attach an image in the $_FILES superglobal to the $page object. I suspect my thinking on how to do this is backwards, and there may be an API method that handles some of the lifting - but I don't mind getting my hands dirty either if I need to code it closer to the metal. I've starting to look at the FieldtypeImage source and the inheritance thereof, but I'm starting to find myself out in the weeds. Does anyone know of a way to affix an uploaded image (outside of the page admin) to a $page object? The input handling of the submission currently looks a little like this: foreach($page->template->fields as $template_field){ $field_name = $template_field->name; $field_class = $template_field->type->className; $update_value = $this->input->post($field_name); switch($field_class){ case 'TitleFieldtype': case 'TextareaFieldtype': $page->{$field_name} = $update_value; break; case 'ImageFieldtype': // <----- the confounder // not sure what to do here if the field // if name is represented in $_FILES break; ... } ... } EDIT: Simplified code block.
  9. Hi all! First of all, it's now been two weeks since i discovered ProcessWire by searching for "content management framework" and finding a Wikipedia article. The article mentioned both Joomla and Drupal - and other CMS/CMF-systems I have worked with before. I had never heard of ProcessWire, and gave it a try. Wow! It's really amazing! I saw the video on the front page, and I decided that ProcessWire just had to be the system I needed for this new page I'm working on. So, why am I posting? I've been working for the last two weeks (part time), and I've all the requirements for the page - except one. It's an internal website for our company (or, to be precise; it's for one of the regional offices for a global company), and we want our employees to be able to register how far they walk/bicycle/run to work. I'm really unsure how to set this up in ProcessWire, and I'm pretty sure I have to do this with some manual PHP/SQL code instead. So, the users on this system needs to: Register a date when they have been working, and how far they have travelled to and from work Preferably also register multiple dates, or a range of dates, when they have been travelling to and from work - together with the distance travelled Admins may select a date range and view sorted tables of travelled distance per employee Users may check their own records, and maybe compare themselves to others Users may check their total distance travelled Users may check their latest registered date Gurus, what do you recommend? What is the best way to do this in ProcessWire? Should I just set this up with separate scripts and not use fields in ProcessWire for this at all? (I know PHP and SQL, so it's not a problem - I just want to do it with the help of the framework if possible.) Thanks a lot in advance!
  10. I started to write this post and at the same time figured out the answer from source. Decided to post my problem, since this is something that is currently missing from cheatsheet (not sure if everything should be there). I create page from API and I need to set that it children get sorted by custom field called candidate_number. How to set that from API? This is how: $p->sortfield = $fields->get('v_candidate_number');
  11. Hey Ryan, I'd like to use Processwire's query parsing functions (or object implementation), which are already implemented to parse module's settings, and parse something else. So what do I need to do, if I have string like customthing=1|2|3, anotherstuff=1 and I would like to receive object (or array) with customthing and anotherstuff as keys and the rest like their values? Thanks
  12. Another error Following code: $page->images->removeAll(); $page->images->add($commitsGraphSrc); $page->images->add($languagesGraphSrc); $page->save(); $page->images->eq(0)->rename('commits-graph-'.substr(date('now'),0,4).'.png'); $page->images->eq(1)->rename('languages-graph-'.substr(date('now'),0,4).'.png'); $page->save(); should delete all images if any, add two new images, save the page, and then remove the images to something sensible from the google chart URL (because $..GraphSrc is google chart api URL). And the delete fails horribly with following: [b]Fatal error[/b]: Exception: Invalid type to Pageimages::remove(item) (in /Users/adam/Sites/this.is.secret/wire/core/Pagefiles.php line 182) #0 /Users/adam/Sites/this.is.secret/wire/core/Array.php(653): Pagefiles->remove('commits-graph-1...') #1 /Users/adam/Sites/this.is.secret/site/templates/github.php(103): WireArray->removeAll() #2 /Users/adam/Sites/this.is.secret/wire/core/TemplateFile.php(92): require('/Users/adam/Sit...') #3 [internal function]: TemplateFile->___render() #4 /Users/adam/Sites/this.is.secret/wire/core/Wire.php(267): call_user_func_array(Array, Array) #5 /Users/adam/Sites/this.is.secret/wire/core/Wire.php(229): Wire->runHooks('render', Array) #6 /Users/adam/Sites/this.is.secret/wire/modules/PageRender.module(236): Wire->__call('render', Array) #7 /Users/adam/Sites/this.is.secret/wire/modules/PageRender.module(236): TemplateFile->render() #8 [internal function]: PageRender->___renderPage(Object(HookEvent)) #9 /Users/adam/Sites/this.is.secr... in <b>/Users/adam/Sites/this.is.secret/index.php on line <b>203</b> Also, if it;s something, I'm not totally sure why calling $this->remove() in the Array does Pageimages::remove... or why the $item in chekcing isValidItem is string and not pageimage.
  13. Hey all, I'm trying to add dynamically generated Google Chart Image to image field, but... it doesn't work $imgSrc = 'https://chart.googleapis.com/chart?chs=920x200&cht=bvs&chd=t:0,7,0,0,4,0,0,0,0,0,0,1,0,0,0,1,2,0,0,0,7,11,4,0,3,4,2,4,6,1&chds=a&chm=B,eeeeee,0,0,0&chls=3&chco=222222' $page->images->add($imgSrc); It fails with 'Exception: Unable to copy: ' and adds a bunch of data. I've got two questions: How can I affect the filename of the file created [thus add some extension, for instance it's PNG file]. And more importantly, why doesn't this work? I know for a fact that URL adding works. Edit: Actually, this is how I save this: $page->images->removeAll(); $page->images->add($commitsGraphSrc); //it's an URL for google chart API $page->images->add($languagesGraphSrc); //another URL for gchart API $page->save();
×
×
  • Create New...