-
Posts
189 -
Joined
-
Last visited
-
Days Won
1
Everything posted by thomas
-
Hi everyone, I refused to switch to another CMS for many years. I worked with a Perl based self-made CMS that produced no markup and provided the basic tools to fill templates with life. After being pointed to PW by a friend I finally made the switch since our CMS is dated and needs to much work to keep at a reasonable level (UTF8 support among things). PW is what we wanted our CMS to be! So I just released my first PW project into the wild: http://bmxrider.de I quickly found myself at home in PW since the workflow is just the one I was used to. I could never make myself use webforms to edit templates or even have my stylesheets in a DB. I used an approach similar to Ryan's described here: http://processwire.c...legate-approach , with a little modification to keep the amount of PHP in my templates to a minimum. My "home" template looks like this: <?php include('./tools.inc'); ob_start(); $news = $pages->find("parent=/news/,sort=-created,limit=3"); $videos = $pages->find("parent=/video/,sort=-created,limit=3"); $aktuelles = $pages->find("parent=/news/|/magazine/|/video/|/termine/,id!=$news|$videos,sort=-created,limit=5,"); include('./news.inc'); ?> <div id="content-sidebar"> <div id="content-left"> <?php include('./videos.inc');?> <?php include('./aktuelles.inc'); ?> </div> <?php include('./sidebar.inc');?> </div> <? $page->body = ob_get_clean(); include('./main.php'); ?> I'm already working on the next PW project and hope to switch all of our company's sites better sooner than later. Thanks for a great product and community! thomas Edit: I forgot to mention the PW credit: http://bmxrider.de/impressum/ ... and also forgot to mention that I my only problem with PW is that it's PHP based. Perl is just much more fun! But I guess I'll get over that ...
-
Not sure what I changed but it works now! Only setTrackChanges produces wild results. Maybe it is because I don't really understand it ...? if($input->post->submit_save) { $edit->setTrackChanges(); $form->processInput($input->post); foreach($form->children() as $feld) { $edit->set($feld->name, $feld->value); } $edit->save(); foreach(array_unique($edit->getChanges()) as $change) { $session->message(sprintf($this->_('Change: %s'), $change)); } When I trackChanges on $edit (which is the page that's being edited) I get loads of message but never one of a field that was actually changed. If I trackChanges on $form, I don't get any messages at all. I guess it has to do with the order but I just can't seem to get it right ... Thanks for you help Ryan! -thomas
-
I generally try to use as little echo lines as possible. My code will be more like this <ul> <?php foreach($some as $else): ?> <li><?=$else;?></li> <?php endforeach;?> </ul> that way i don't have to worry about indention ...
-
Thanks for the info. I cranked up the memory limit to 2GB and uploaded 300MB videos on my localhost but wasn't sure if that's a route worth going on a production server. I'll probably just use SWFUpload from the old site.
-
Actually it is, because I want to restrict the frontend form to registered users with a certain role anyway. Any idea why the whole select and save works, as well as creating a new page, but creating one and then saving with it selected fails? Thanks, thomas
-
Hello, since I almost finished my first processwire project I am somewhat tempted to rebuild other sites that need a relaunch anyway. One of which is a video site where selected people can upload videos which are transcoded on the server into different formats (m4v,webm). This site is build in symfony 1.4 and since every little change always takes me ages to commit, I would very much like to rebuild in PW. One of my first questions for this project is if the inputfieldFile Ajax upload would be suitable for large video uploads up to 1GB or if I should rather use SWFUpload like the old site does ...? Does anyone here have any experience with those kind of uploads? Thanks, thomas
-
Thanks Ryan, my form works so far, the only thing missing is "create page" in the InputfieldPageAutocomplete.module. Adding existing pages works fine, but creating one and adding it throws this: Error Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /wire/core/Selectors.php line 165) #0 /wire/core/Selectors.php(190): Selectors->create('', '', '-1') #1 /wire/core/Selectors.php(63): Selectors->extractString(-1) #2 /wire/core/Pages.php(132): Selectors->__construct(-1) #3 [internal function]: Pages->___find(-1, Array) #4 /wire/core/Wire.php(269): call_user_func_array(Array, Array) #5 /wire/core/Wire.php(229): Wire->runHooks('find', Array) #6 /wire/core/Pages.php(202): Wire->__call('find', Array) #7 /wire/core/Pages.php(202): Pages->find(-1, Array) #8 /wire/core/Pages.php(217): Pages->findOne(-1) #9 /wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module(78): Pages->get(-1) #10 [internal function]: Inputf The same field works fine in admin. Any hints?
-
Hello everyone, Interesting thread! I am trying the same thing as Diogo but I need one file upload to work ... I'm getting this error Error Call to a member function path() on a non-object (line 90 of /wire/modules/Fieldtype/FieldtypeFile.module) Can someone help me make this FieldtypeFile work outside of the admin? Thanks, thomas Edit: I almost got it. /wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module holds all the secrets
-
Cheers Pete, that pretty much what I'm going for now. I use the ID from the network as unique identifier and password and generate a username that I query from the DB as soon as someone returns. It works great with Google already, now I need to squeeze Facebook in there as well. Ryan, thanks for tips! It's amazing how many ways there are in PW to achieve a task. I need individual accounts though, since I need to give at least two different roles to people and I want them to be able to update their profile. Thanks guys! thomas
-
Cheers SiNNuT, I've got the OAuth part figured out. Especially the 9lessons page helped. Now I try to find a way to connect it to PW users. Right now I tend to - set a username (generated by displayname on G+ or FB) and the ID as password. Then if someone returns to the site, look for the username to the G+ Id in the DB and log him in with that ... Sorry for the messy posts, it's hard to switch between PHP and English ... thomas
-
Hello, I want to build a site where people can *only* login with Google and/or Facebook (no registration possible). When someone connects with G+|FB I'd like to check if the ID is present in my Userlist and if not, create a new user with all the data I can get. Now I'm asking myself (and you) how I can log the user into PW, since I won't have a password and the username they got on FB|G+ might even change. I need to find those accounts by the FB|G+ ID. I thought either to create a new user with username/pass = G+|FB-ID and a field stating if it's G+ or FB. The other way would be to have a way to select and login a user via a unique ID field, but i can't find something like a "loginByCondition" method in PW. So I guess my questions are: -is there a way to login users other than user/pass? - which way would you suggest to build a system like that? My problem with the "user and pass == G+|FB-ID"-approach is that it smells like dirty hack and I couldn't, for instance, connect my own admin account with FB or G+ to make it work in front- and backend. Any help and thoughts are appreciated! Thanks, thomas
-
Thanks Soma!
-
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
-
A different way of using templates / delegate approach
thomas replied to Soma's topic in API & Templates
Cheers, I'll take another look at your approach then -
A different way of using templates / delegate approach
thomas replied to Soma's topic in API & Templates
Ryan's, where the dynamic content is definded in the page's template before callling the page structure (main.php). -
A different way of using templates / delegate approach
thomas replied to Soma's topic in API & Templates
My question is how you deal with functions that are potentially needed in every single page on the site. Putting them into main.php doesn't work in this example, because those functions are needed in teaser.php, which is called before main.php. One way would of course be to put include('./functions.php') into every template but I was wondering if there's a way to specify a file that is automatically included into every template. -
A different way of using templates / delegate approach
thomas replied to Soma's topic in API & Templates
Thanks for the interesting thread. If you (like me) don't like to put markup into variables, you can use the output buffer to use cleaner include files: ob_start(); include('./teaser.php'); include('./pager.php'); $page->body = ob_get_clean(); include('./main.php'); That way your include files can be html with php elements and not $page->body="<p>something</p>" I have one question to the main.php approach, though: I have a bunch of functions that are used by several templates. With the head/foot method I would simply put them into head.inc and make them available to every page. Where do you put this when using a main.php? Would that be a module? Thanks, thomas -
Cheers slkwrm!
-
Hi Diogo, one change was neccessary: if($tagPage instanceof NullPage) { ... } Other than that, spot on! Thanks! -t
-
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
-
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
-
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
-
I just used this for my search question (http://processwire.com/talk/topic/1561-search-fieldtype-pages/) and it works great. Thanks!
-
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
-
Thanks for the hint! I keep forgetting those pages stored in the fieldtype "pages" are just pages ...