Jump to content

RyanJ

Members
  • Posts

    208
  • Joined

  • Last visited

Everything posted by RyanJ

  1. If a page contains an image, I get no error. If a page does not contain an image I get the following. Fatal error: Exception: Invalid type to Pageimages::remove(item) message. Any suggestions is appreciated. my code: $first = $page->image->first; if (count($page->image) > 1) { echo "<h4>$page->title</h4>"; } foreach($page->image->remove($first) as $img) { if ($img) { echo "<img src='{$img->url}' />"; } }
  2. Hi Ryan, My question above unfortunately was unclear and I apologize. It was clear in my head, but often is harder to explain when typed. To sum it up, I wanted to keep track of each players stats to include their opponent, kicks and punches. Each player can have up to 10 opponents so what I did was create an opponent field, kicks field and punches field and put them all in a repeater field and assigned that to the player template. Then I wanted to show the total kicks and total punches for each player. This was easy to do on the player template. Getting the total amounts of Kicks and Punches was key. Now, on a new "Leader" page, I wanted to loop through all players plus show their total kicks and total punches. Because I was using repeaters, there was no way for me to get the total kicks or total punches for each player. I would end up with something like so: Player Name Total Punches Total Kicks player 1 8 10 player 1 4 5 Player 2 3 5 Player 2 6 3 So what I did to solve this was create my first module (hooray for me) and added two hidden fields, totalpunches and totalkicks to the player template. The module loops through the repeater field for each player adding the kicks and punches and storing their totals in the hidden fields. I then just pulled in the player and their total fields on the "Leader" template. The moral of the story here is several things: 1. Creating the module was intimidating since php is murky, but OOP is like the black sea to me. After reading a few post, your tut here and having a look at the hello world module, I just dove in. I am glad I did. 2. I did not want to use repeaters because I was concerned if the site grew they would not scale well. Fortunately for me you came to the rescue again here With all that said, I am sure there is a better way or it is possible without the module, but this way works as well.
  3. Awesome Ryan! Thank you for your time and clearing the murky water for me and hopefully others.
  4. RyanJ

    Pay method

    I am confident it is the window.open method. Check out a this or this you could also try to pass _self like so. <a href='javascript:calc('_self')
  5. Hi Ryan, Thanks for the response. Great to know about the page id's and the possibility to make them behave like page references. I would like to pick your brain or someone's brain much more experienced then me if possible. I have been able to add new text fields relatively simply to the module, but was confused on one part. In event.php in the public get and set functions you sanitize the text values like so else if($key == 'location' || $key == 'notes') But lets say I wanted to add 5 or more text fields. Doing something like this seems incorrect? else if($key == 'location' || $key == 'notes' || $key == 'another' || $key == 'another1' || $key == 'another2') Also adding an integer field would be similar the the current date field? Currently I am using repeaters to accomplish this and feel this module is a better fit although I still run into the issue at hand posted there. Thanks for any suggestions.
  6. RyanJ

    Pay method

    calc function is causing it to open a new window with vent=window.open('','tpv','width=725,height=600,scrollbars=no,resizable=yes,status=yes,menubar=no,location=no'); Try replacing it with vent=window.open('','tpv','_self','scrollbars,resizable,status=yes,menubar=no,location=no');
  7. Glad you got it working. I should have re-read your post better paying attention to "user". I also should have realized I was in the Multi-Language Support section. I am glad apeisa picked up my slack and pointed you in the right direction.
  8. I am not really sure what you have going on, but your current code does not make any sense to me. Can you show me an example of the site? What are you looping through? Pages? There are better ways I think you could do this, but here it what you are trying to do should look like <?php foreach($languages as $language) { // loop through $languages if($language->title == 'hebrew') { // Now that you have $language, check if its title is == hebrew echo "<body style='direction:rtl;'>"; // if it is, assign it a style } else { echo "<body>"; // if not, echo body with no style. } } ?>
  9. Is this your full code, cause I do not see where you are echoing $language anywhere?
  10. I am struggling with a simple concept at the moment and any direction is appreciated. I have a set of players and each player has a repeater field which contains several other fields ie punches, kicks, ect. On the individual player page/template, Opponent, Punches and Kicks are all fields contained in the stats field which is a repeater. I have also totaled each field as shown below. Easy enough Individual Player 1 Page Opponent Punches Kicks Player 2 3 4 Player 3 5 6 _________________________ Total 8 10 However, now I want to display all players on one page with their total stats. What I have so far you wonder? (its clearly not correct) $leaders = $pages->find("template=player"); $total = 0; foreach ($leaders as $player) { echo "<tr>"; echo "<td><a href='{$player->url}'>{$player->title}</a></td>"; foreach ($player->stats as $stat) { echo "<td>$stat->punch</td>"; } echo "</tr>"; } From the example code above, I get the below output. **Note that the 3 and 5 are punches from the previous diagram. Player Name Punches Kicks player 1 3 5 player 2 Player 3 But this is what I want it to show Player Name Total Punches Total Kicks player 1 8 10 player 2 10 17 Player 3 5 6
  11. Your addition did the trick Ryan, thanks! I am working on a stat based website that keeps track of statistical data for individual people ie age, weight, height, ect. This would be the perfect module for it instead of creating multiple fields using repeaters which in the long run would not scale from what I have read. Could you use page fieldtypes with this module, allowing the user to select from a preset list of pages/categories created in the admin area? In the mean time I will be trying to figure out how to add new text and digit/float fields. I would also be interest in possibly sponsoring future development of this module to allow fields to be created on the fly since my php skills are sub-par. As always, thanks for providing it.
  12. RyanJ

    I'm back

    I think if you searched the entire web of forums you would be hard pressed to find a more responsive forum with such dedicated members. I hope those of use trying to learn ProcessWire everyday can help out in the future. It also baffles me that Ryan leave no question unanswered.
  13. I just downloaded this module and wanted to try it out. However, when I try to edit the page with the assigned template/field I am getting this error. Fatal error: Can not call constructor site/modules/FieldtypeEvents/EventArray.php on line 14 It is probably user error, but I cannot figure it out.
  14. RyanJ

    I'm back

    Looks like ya'll had a great vacation, welcome back. Merry Christmas & Happy New Year to you and your family as well.
  15. Google's Compute & App Engine are definitely stealing some headlines recently. I was curious if anyone had attempted to run Processwire from it? After doing some research, it appears it handles WordPress perfectly fine so I do not see any reason Processwire could not operate on it as well. Since Processwire crushes WordPress in the way it performs, scales and handles data. I think having the power of Google's servers to serve your app/website, could really be beneficial for those running into storage/bandwidth issues. Some other thoughts or opinions on this?
  16. I guess an example on my part would have been helpful. Sorry about that. Good thing there is always someone else in the forum that steps up to the plate.
  17. Hi Joss, Could you wrap the content in a if statement checking if any page is greater then 1 do not display? Ryan does this in the pager module. Only shows the previous link if the page number is greater then 1.
  18. Thanks for sharing your approach Ryan. I think the xml feed is definitely the difference here. In my situation there was no feed submitted, just the url. After changing the structure to include the articles date, the articles appeared in Google News. It must be a case of this format or that format ...
  19. Hi Xeto, You can do this easily. Just create the categories in the backend and reference their id on the csv you are wanting to import. See Niks post http://processwire.com/talk/topic/383-module-import-pages-from-csv-file/?p=21476
  20. I think Home should be just that, a portal to your products and blog. You could pull in a limited amount of products on the home page using the "limit" selector and then offset them with the "start" so they do not show up on both home page and products page. If you are set on wanting to display all of your products on your home page, this is what I would do. "Products" page would be used as a place holder in the backend and I would assign it a blank template and hide it.This way if a user accesses mysite/products, they are thrown a 404.
  21. I may be completely off, but do not see where you are outputting anything. Just a disclaimer, I'm still learning myself, but thought I would give it a try. Someone will correct me I am sure .. $out = ''; if($input->get->q) { $q = $sanitizer->selectorValue($input->get->q); $input->whitelist('q', $q); } $matches = $pages->find("image.imageTags%=$q, limit=20"); if(count($matches)) { $out .= "<h2>Found $count pages matching your query:</h2>"; foreach ($matches as $match) { $out .= "<a href='{$match->url}'>$match->title</a>"; } } else { $out .= "<h2>Sorry, no results were found.</h2>" . "<h2>Please enter a search term in the search box (upper right corner)</h2>"; } include("./head.inc"); echo $out;
  22. Hi, Have you had a look through the forum? I think you will find your answer, but to answer your question, yes. With Processwire, the sky is the limit. Have a look (just a few) http://processwire.com/talk/topic/4925-is-it-possible-populate-site-pages-from-a-form-submission-adding-content-without-admin-access/?hl=%2Bsubmit+%2Bpage+%2Bthrough+%2Bforms#entry48121 http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ http://processwire.com/talk/topic/2937-creating-a-front-end-admin/?hl=%2Bsubmit+%2Bpage+%2Bthrough+%2Bforms#entry28954
  23. Hi, Here are a few links to get you started. Has example of a form built already http://processwire.com/talk/topic/59-module-want-form-builder/page-4#entry11639 A tutorial on building forms using PW fields. You should read through this and compare it to Ryan's post below. It will explain a lot. http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ Ryan's simple contact form. I just used this the other day. All you really have to do is copy and paste his code. You would exclude the include("./main.php"); unless you have one of course and echo out the form as shown below. http://processwire.com/talk/topic/407-processing-contact-forms/?hl=%2Bcreate+%2Bsimple+%2Bcontact+%2Bform#entry3208 include("./head.inc"); echo $page->body; include("./foot.inc");
  24. I had actually added the template=child-template part but was unsure of its effectiveness. template!=a-template even sounds better. It is great to have someone giving you new perspectives and options on how to do/see things differently. It is all too often the brain gets tunnel vision and cannot think of a different solution. I am glad you took the time to make it clear and give a different perspective. Once again, I thank you.
×
×
  • Create New...