Jump to content

John W.

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by John W.

  1. Exactly what I was looking for. That worked @adrian You provided a great solution that works. I would have never thought of $item->{$field->name} as storing the value of the field. The way I was originally thinking, in pseudocode was something like: $all-repeater-fields = $page->my_repeater->getchildren(); foreach($all-repeater-fields as $a-field) { echo $a-field->name; echo $a-field->value; } Could you also guide me into a direction in the PW docs or method in which you came across this? It seems little things like this, I dig into the documentation and API reference, and just can't find good examples/explanations for these types of questions. I try using var_dump() and the docs to try to 'connect' the dots, but something with the way I'm researching just isn't 'clicking'. The idea of $item->{$field->name} holding the value for the field would have never crossed my mind. Thanks so much for the assistance --
  2. I've been trying to figure a way to output the values of several fields within a single repeater using a foreach() without having to reference the name of the fields. Typically, for repeaters, I understand you would do foreach($repeater_field as $afield) { echo $afield->fieldname_a; } pretty straight forward. Anyways, what I'm doing is using a single repeater as just a container for other fields. I've tried using $page->my_repeater->getArray(), then looping through the array, and all sorts of methods, without luck. It seems I must specify the field name for output. For instance, my (single) repeater is set up to hold a few different fields: my_repeater field_a field_b field_c Trying to output it using something like this: foreach($page->my_repeater as $afield) { echo $afield->value; // I'm not wanting to have the reference the field name e.g. use $afield->field_a } Any suggestions?
  3. I know the point of PW forums is to discuss PW. I was just wondering if any consideration can maybe given to set up maybe a forum section called 'Front End Frameworks & PW', and maybe just a couple subsections like 'Bootstrap' and 'Zurb Foundation', (just maybe 3 of the most popular frameworks), to discuss questions integrating those with PW?
  4. I'm working on a site where I need to output data for a table. I looked at the Matrix plugin, but, I don't think it does exactly what I want...since my particular table is split into colspans i.e. Direct, Maternal, Carcass, and $Index An example of the table output is attached. I've pondered using 3 repeaters for the first column titled, EPD, Acc and %Rank. Each one of these repeaters would have the fields for CE, BW, WW, YW, MCE.... The last thing I want is to have to create a very long list of inputs vertically down the page for each field in the back-end for my client. Any PW gurus here, maybe help me out? If there is absolutely, no alternative to make input simple for my client, let me know if I have to buy ProFields. thanks mucho!
  5. Thanks. I fresh installed 3.0.42 on my local system. I then exported the database from a previous site running on 3.0.42. Next, I imported the database, deleted templates/fields that I not re-occuring across projects, installed my modules, setup my custom ckeditor .js and .css files. Finally, I ran the ProcessWireUpgrade to upgrade the local site to 3.0.62. It all looks good. From here out, I'll run ProcessWireUpgrade, then use the profile export module when setting up a new site. Thanks for the help! Btw, when I set up on a remote site, I always use the PW installer. After that I import JUST the db from my local install, ftp upload the templates folder and lastly use the api to set a new password for the admin account for login. - never had an issue.
  6. Question 1 I recently installed PW 3.0.62 for a new site and also have sites running older version of PW 3.x. Can I export the database on an older version of PW 3.x and import it to PW 3.0.62 without any issues? Question 2 (This is kind of alternative to the above for long term use - and maybe a better solution...) On the sites I've previously built I have templates (home, basic-page, contact) and fields that I commonly use, such as business_name, phone_1. The last site I built is running PW 3.0.42. I was considering cloning this into a local site and running the upgrade module to bring it up to PW 3.0.62. From there on out when I start I new project I could just run the PW upgrade module, copy the folder to the location for the new project and duplicate the database using the new projects name. So basically, I'll always keep a "blank slate" site that I can just run the PW upgrade on, then duplicate into a new project. This would cut down on the work and time spent having to re-create these common fields, that I use. From there, I would just add fields, templates, etc, specific for the new website project. Is this a sound approach to speed up development?
  7. I just posted a question about moving PW from a resting domain to a production domain, after consideration I figure I would create a new post for a second question I have. I noticed the coming feature of client size image resizing. This will be really helpful, as I have some clients on a Satellite connection. I'm telling you, them trying to upload 15MB images, or them getting them straight on batch resizers (or Photoshop) to resize before upload is a real chore. Needless to say, Ryan has been doing an excellent job addressing this. My question, is that I have several clients on PW 2.x thru 3.x. Is there a really good guide on steps that I need to take to update the core to take advantage of the features of new releases? Are their perils to look out for? Yeah, after developing several sites, I feel a bit silly about asking this one, but, the docs doesn't seem to be clear in a "general" sense of upgrading the core across all versions. Thanks everyone for your time and assistance.
  8. Summary: If I have a site sitting on a server called testing.com, then on the server change it to mycompany.com, do I have to modify any settings in ProcessWire? After building several processwire for clients, the one question that I haven't had is about moving a processwire site from an old (temporary) domain to a new domain. For instance, I typically setup development sites for clients and register a temporary domain (and lock with a password). For instance, thee client can go test.com and get all their content finalized, change wording, add news, swap out photos -- everything to make the site production read. Next, on my hosting account I can have testing.com renamed to theircompany.com - and change the nameservers. A simple question here. If I have a hosting company rename the account from testing.com to theircompany.com, change my nameservers whereas going to theircompany.com loads the production site, Is there anything I need to change in the processwire configuration or in the PW database? In the past, I've just manually copied the site, and fresh-installed PW, and imported the data. Seems like a lot of hassle. I have a second part question about updating the PW core, however, after consideration I'll post it as a new topic.
  9. Also check the permissions on your /site/assets/files folder. Should be 755.
  10. I ran into an issue a Wednesday, where a client on satellite getting logged out every few seconds. The above fixed it, however, I had to change the config.php file in the /wire/ directory. I didn't see the setting in the /site/config.php, so I assume that it's due to changes in PW since this post was originally written. Thanks for the tip @adrian
  11. Thanks, that fixed it. There was a space between mystyles: and /site/modules/ ... the the correct syntax mystyles:/site/... and not mystyles :/site/... A note for other readers, the Styles drop-down wasn't displaying anything after the change quoted above. However changing the style name in the mystyles.js file from: CKEDITOR.stylesSet.add( 'default', [ to: CKEDITOR.stylesSet.add( 'mystyles', [ fixed the issue of the styles list being empty. @Macrura - thanks!
  12. Thanks adrian & Robin S for the additional information.
  13. This question has probably been beaten to death - think I'm approaching this wrong. Anyway, I've got a textarea input field that uses ckeditor. Under the fields Input section I managed to add my custom style sheet in the 'Custom Editor CSS File (regular mode) section for instance: /site/templates/css/ckeditor.css This seems to work fine. What I'm trying to do now is add a custom style to the ckeditor styles menu, for instance, called .green_button (p.s. in the ckeditor styles.js I added this to the inline section : { name: 'Green Button', element: 'a', attributes: { 'class': 'button' } }, Ok, onto the problem... I notice that PW, by default, is using /wire/modules/inputfield/inputfieldCKEditor/ckeditor-4.5.10/styles.js So, I copied this into /site/templates/js/mystyles.js Next, I added the above to the 'Custom Editor JS Styles Set' field, however, it doesn't seem to load myckeditorstyles.js -- rather continues to load the one from the /wire/modules... folder. I cleared all history and caching in Safari (also tried Chrome, etc). I'm wondering if there is something else I need to do to have PW load my /site/templates/js/myckeditorstyles.js instead of the one in /wire/modules.../ckeditor-4.5.10/styles.js ? Thanks!
  14. Thanks, that is exactly what I was needing, Zeka. I kept trying to use $pages->find and set a limit=4, sort=random type of selection. Your solution above worked.
  15. No. The only page is called testimonials, which uses a template named testimonials which contains the field testimonials_repeater. Thus something like: $testimonials = $page->testimonials->testimonials_repeater->getRandom(4) also tried $testimonials = $page->testimonials->getRandom(4); but, both return an undefined function for getRandom();
  16. Following the example from the PW docs I set up a a repeater. I'm trying to fetch random fields from a repeater, for instance, display 4 random customer testimonials. Here is the basic setup in PW: created these fields: testimonial_text testimonial_name I then added them to a repeater field called: testimonials_repeater Next I added testimonials_repeater to a template called testimonials Last, I created a new page called Testimonials using the testimonials template. As far as fetching all the testimonials I'm doing this: <?php $testimonials = $pages->find("template=testimonials"); foreach($testimonials as $trepeater) { foreach($trepeater->testimonials_repeater as $t) { echo $t->testimonial_text . ' -' . $t->testimonial_name; }} ?> Could some please give me some guidance on how to pull, for instance, 4 random testimonials? I mean, I could stick the results in an array[] inside the foreach loops, then random sort the array, then output only 4, but there has to be a better way using PW. Also, is there a way to limit the number of records (customer testimonials) that can be added by the user? Repeaters just always seem to trip me up. :/ thanks much!
  17. Gotcha! I really appreciate your help on these topics and especially pointing me in the right direction on the API docs with the reference links.
  18. I do have another quick question. Basically when a user edits a song there is a drop down lists of artist names which the data comes from a Page type field called song_artist_selections. I was wondering when bulk adding records how to set the value of this field? pseudo code $mypage = new Page(); $artistname ='Elvis'; $mypage->set the song_artist_selection to 'Elvis' ... $mypage->save() P.S. where in the docs did you find information on the add() method? e.g. $mypage->song_mp3->add($mp3file); ? Thanks again.
  19. Thanks. I tested it and it uploaded the mp3 from a temp folder then added a new record. Final (snipped from my) code: $mp3file = 'temp/' . 'song1.mp3' $mypage->save(); $mypage->song_mp3->add($mp3file); $mypage->save();
  20. $mypage = new Page(); $mypage->template = "song"; $mypage->parent = $pages->get("/songs"); // root $mypage->title = "My New Song"; $mypage->song_number = "004"; $mypage->song_commentary ="this is the commentary"; $mypage->save(); Using the example above I was wondering if there is a way to supply the name of an mp3 file and when $mypage->save() executes the mp3 will be added to the processwire database and uploaded into its assets folder? For Example: I have a field song_mp3_file which is a File Type field. I have temporary copied all the mp3 files in templates/temp/ song1.mp3 song2.mp3 If I set a value like this, will PW know it is a File Field type and automatically upload it to its assets folder and add it to the database? $mypage->song_mp3_file = "temp/song1.mp3" The above code (at the top of the post) works fine to quickly add records, I just don't want to have to go into every song's page and manually upload each mp3. Thanks!
  21. I edited the question as you were composing. And I'm talking all backend with pw ... not front end ajax.
  22. Just one last question for future reference/projects. I only have a couple songs, not a huge set. Using PageListSelectMultiple input type. How well does it handle a thousand items/songs when the page loads? I was kust thinking in that case it might be best to do somethink like; Acoustic (1940's) song 1 song 2 Acoustic (1960's) song a song b
  23. Excellent! For a quick test - I created a temp_playlist template which contains the title and a field called temp_song_selector. The temp_song_selector is a page field with an input type of PageListSelectMultiple that uses the songs stored in Songs. That input type which is user sortable is exactly what I was looking for -- or maybe thinking too hard overlooked it. I'll play around with it tomorrow more in depth. Thank you so much.
  24. The songs are already under a page called Songs where you only create one entry per song. The same with Genres and Artists. Genres Rock Rap Artists Elvis Eagles Eminem Songs Blue Suede Shoes Hotel California Stan When you create a song, like "Hotel California", you can use a pull down (pagearray) to select the artist and genre. The problem is creating multiple playlists, where I can add songs to differing playlists and be able to sort the songs manually. The attached photos might help. The only problem with this solution is if you add a (child) to Acoustic you have to re-type in the song Title, then on the next page, my pagearray drop-down will let you select a song from Songs.
  25. edit: before reading through all of this. Is there a way to have PW display a page array drop down list to select a Title vs having to type in the Title when creating a new (child) page? --- I'm converting an old music site where custom built the back end to a responsive site and using processwire now as the back end. In my old site I can add a song, attach it to multiple genres and within the list of genres manually sort the songs. So here is what I have done in PW. 1. created a Genres page where I can add a child genre. The child genre is nothing but a template with the title field. 2. created a Artists page where I can add a child artist. The child artist is nothing more but a template with the title field. 3. I created a page called Songs. The songs page uses a template that has the following fields: title, song name, mp3 upload a select box for selecting the artist from a pagearray (see 2) a list of check boxes for assigning different genres to the song. (see 1) (for instance, a song can be in the genres Pop AND Nostalgia Thus : HOME Genres 3 Acoustic Nostalgia Artists 1 Elvis The Eagles Songs 2 (fig. A) Hound Dog Blue Sued Shoes Hotel California (acoustic) What I'm trying to achieve: I'd like to achieve a layout like this, or similar function that will let me add to a playlist of genres and be able to sort those songs manually without having to re-key each song for each genre. Play Lists 3 Acoustic (2) Blue Sued Shoes Hotel California Nostalgia (1) Blue Sued Shoes The Problem As you can see, if I were to add a child (blue suede Shoes) to Acoustic or Nostalgia, I would have to basically use a "song" template and re-enter all the information about the song. Ideally, it would be nice when adding a child to the Acoustic playlist I could just select a song already in Songs 2 (above). To get this type of listing in the back end: All the genres and child songs able to be manually sorted. Playlist 3 Acoustic 2 Blue Sued Shoes Hotel California Nostalgia 1 Blue Sued Shoes Pop 0 The only near solutions is to create a Genre template with a pagearray field which contains a repeater field for songs. This would work on a site with few items per Genre, but, the repeater field would hit in performance if there were thousands of songs. The only other though was to create a Play List page like so: Acoustic (2) Blue Suede Shoes Hotel California Nostalgia (1) Blue Sued Shoes In this scenario, the client adds a new child song to Acoustic. They would have to re-type the song title, press ok, then would be displayed a template that simply lets them select a song from drop-down that contains a pagearray containing the list of songs that I created see above (Fig. A) For what I want to do, this seems to be the only solution. It's just invonvenient if they go change the name in the Songs list they would have to go into Acoustic and change the Title field there to match. Ideally, if someone knows hows a way to modify PW to allow you to select an entry from a page array dropdown list vs the required Title field when creating a new child (page), that would be awesome! Can anyone suggest some tips or insights if I have overlooked anything?
×
×
  • Create New...