Jump to content

spercy16

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by spercy16

  1. Please disregard this post! I updated my password again and it started working immediately.
  2. I just finished developing the latest version of a website on my computer "localhost" but am getting this error message when I try and access the live site: Error: Exception: SQLSTATE[HY000] [1045] Access denied for user 'delorain_spiercy16'@'localhost' (using password: YES) (in wire/core/WireDatabasePDO.php line 445) #0 wire/core/WireDatabasePDO.php (445): PDO->__construct('mysql:dbname=de...', 'delorain_spierc...', 'aT3509shCBbBeC', Array) #1 wire/core/WireDatabasePDO.php (780): WireDatabasePDO->pdoWriter() #2 wire/core/WireCache.php (277): WireDatabasePDO->prepare('SELECT name, da...', Array) #3 wire/core/WireCache.php (151): WireCache->get('Modules.site/mo...', NULL) #4 wire/core/ProcessWire.php (503): WireCache->preload(Array) #5 wire/core/ProcessWire.php (304): ProcessWire->load(Object(Config)) #6 index.php (52): ProcessWire->__construct(Object(Config)) #7 {main} I simply coppied over all of my files/folders from my laptop to the server and exported/imported the MySql database from my system to the web host. Here is what is in my config.php file under the database configuration section: $config->dbHost = 'localhost'; $config->dbName = 'delorain_pwdb'; $config->dbUser = 'delorain_spiercy16'; $config->dbPass = 'correct_password_is_here'; $config->dbPort = '3306'; I saw in another post that some hosts won't allow "localhost" but they didn't specify what should be there in it's place. I do have the user account delorain_spiercy16 added as a "privilaged user" with all of the rights enabled and double checked that the password is correct. Any advice on how to correct this problem would be very much appreciated! Thanks in advance for any replies.
  3. Thanks for the additional links! I bookmarked them all and will review them when I have a chance.
  4. Wbmnfktr, I no longer use Perch so screenshots aren't possible. It's a paid CMS, and I'm currently doing work for organizations that can't afford it (NPOs). Plus their support was horrible so I decided to find a better option, which is when I found ProcessWire. I briefly looked at the Functional Fields page you linked to and it is very similar to how Perch works. I haven't used Perch for several years though so I'm not sure if I could do the same things in Processwire or not. The suggestion elabx made, to use whole pages as the cards and then just bring that info into the page I need, is an great option as well. I never even considered using pages like that (as "data buckets") but will try that method soon and see if I can configure it to meet my needs. It would definitely be more user-friendly to do it that way as I could configure the field widths to be less than 100% (which they're not configurable in the Repeater module). Thanks to both of you for the excellent extra ideas!
  5. I was previously using individual fields to capture and output multiple cards onto my web page but after recently learning about repeaters would prefer to use this field type, as it will be a lot more user friendly for end users to create new cards. I tried to modify my code to grab the fields from the new Repeater field(s) but am getting this error message on the page: Here is the code I'm currently trying to use for the cards: <?php // https://processwire.com/api/arrays/ // check if the array of images has items foreach($page->tall_card as $card) { $count = 0; $count++; $options = array( 'quality' => 70 ); $image = $card->image; $img = $card->image->size(550, 400, $options); $cardHeading = $card->title; $cardBody = $card->plain_paragraph; $raised = $card->raised_amount; $goal = $card->goal_amount; $link = $card->link; if ($raised == 0 ) : $percent = 0; else: $percent = $raised_amount / $goal_amount * 100; endif; if ($percent <= 5) : $percent = 0; endif; ?> <span id="card<?php echo $count?>" class="card"> <img class="cardThumb" src="<?php echo $img->url; ?>" alt="<?php echo $image->description; ?> Thumbnail" /> <div class="cardBody"> <div class="cardText"> <h2><?php echo $cardHeading; ?></h2> <?php echo $cardBody; ?> </div> <div class="progressBarSection"> <progress class="progressBar" id="progressbar<?php echo $count; ?>" value="<?php echo $percent; ?>" max="100"></progress> <span class="raisedAmount"> $<?php echo $raised; ?> usd </span> <span class="goalAmount"> $<?php echo $goal; ?> usd </span> </div> <div class="primaryBtn"> <a href="https://www.paypal.com/donate?hosted_button_id= <?php echo $link; ?> &source=url"> <button> <i class="fas fa-donate"></i> Donate </button> </a> </div> </div> </span> <?php } ?> Thanks in advance for any help!
  6. The one obvious downside of ProFields is the cost. $160 is steep, especially if you chose PW because it was free, for example to make sites for organizations like Non-Profits, like I currently am. Mystique doesn't look like my cup of tea mainly because it stores the data in a JSON file (database) and not in MySql, and they admittedly mention that "searching for data is limited" because of that fact. So, repeaters sounds like my best option right now, so I'll definitely play around with them a bit. Thanks again for the suggestions!
  7. Thanks Ivan, I'll look into all three extensively as I firmly believe this is the one thing in PW that should be done differently. I absolutely love the CMS otherwise. Thanks for the speedy reply and links!
  8. Coming from Perch (CMS) to Processwire, the one major downside I've found is that every place I want to insert content into my pages requires a single field (be that an image, integer, string, etc.). This can be a real pain to setup and manage if you have a lot of pages, many of them with dozens of unique fields. For example, on the Projects page of a site I'm working on right now I have to have fields for donate_amount (1-15, meaning fifteen unique fields that I have to duplicate manually), goal_amount(1-15), card_body(1-15), etc. After using Perch for a while, the way their system works is simply easier. You instead create your fields in a single PHP template (for every unique section, like a card) and their CMS imports those fields into the CMS when you choose to use that card, then you just fill in the values. You can also choose to reuse that card multiple times and each one you add gives you the several fields you need to fill in. So you can easily add your 15 cards, each with a picture, title, paragraph, and link, etc. and each one is basically given a unique ID that you can reference in your CSS files. If there's any way to make fields and templates work more like that, it would be a truly outstanding and efficient CMS. The great advantage of the way Perch is setup is that I can make a card with 10 fields, if need be, and easily duplicate that card out 40 times if I need 40 cards on the page and wouldn't need 10 fields for 40 cards (meaning in PW I would need 400 fields). If there's an easier way to do this in PW I would love to know, but as of right now, from what little I do know about the CMS 400 fields would be the only way to set that up, and that would be much more time consuming than if I could create one card (in PHP) with 10 fields that automatically added a number to the end of each field for each card (if that makes sense).
  9. When I go to fields in PW, in order to delete them you currently have to open each one, go to actions, click delete, check the box, and click delete. If you could make it so that you could edit/delete multiple fields at a time this process would go much faster.
  10. Cehlo, Bypassing typecasting worked. I had to create all new fields in ProcessWire (kind of a pain that I couldn't simply change the types from text to integers...) but now everything works. Thanks for all of your help!
  11. Rash, I just inserted in all of the code exactly as you have it and got: 40000, string 40000, string 0, integer 0, integer
  12. This is how I would typically write those declarations (and I'm sure is the better, more proper way) but they do seem to work either way: $sectionText = $page->get("paragraph_".$count);
  13. Cehlo, Firstly, in PHP you do not have to declare variables before assigning values to them... In other languages like C, C++, and Java you do, but not PHP. Second, I have used raisedAmount$count and goalAmount$count in other places and they work correctly. $count is another variable that starts with 0 and increments each iteration through the loop (outputting my cards, as mentioned). Here is the full code: <?php // https://processwire.com/api/arrays/ // check if the array of images has items if (count($page->images)) : // get array of images from the field $images = $page->images; $count = 0; // iterate over each one foreach ($images as $image) : $count++; $sectionText = $page->get("paragraph_$count"); $buttonCode = $page->get("url_$count"); $options = array( 'quality' => 70 ); $img = $image->size(550, 400, $options); $raised = $page->get("raisedAmount$count"); $goal = $page->get("goalAmount$count"); $goalNum = (int) $goal; $raisedNum = (int) $raised; if ($raisedNum !== 0) : $percent = $goalNum / $raisedNum; else: $percent = 0; endif; ?> <span id="card<?php echo $count?>" class="card"> <img class="cardThumb" src="<?php echo $img->url; ?>" alt="<?php echo $image->description; ?> Thumbnail" /> <div class="cardBody"> <div class="cardText"> <h2><?php echo $image->description; ?></h2> <?php echo $sectionText; ?> </div> <div class="progressBarSection"> <progress class="progressBar" id="progressbar<?php echo $count; ?>" value="<?php echo $percent; ?>" max="100"></progress> <span class="raisedAmount"> <?php echo $raised; ?> ksh </span> <span class="goalAmount"> <?php echo $goal; ?> ksh <?php echo $percent; ?> </span> <span id="raisedNum<?php echo $count?>" class="hidden"> <?php echo $raised; ?> </span> <span id="goalNum<?php echo $count?>" class="hidden"> <?php echo $goal; ?> </span> </div> <div class="primaryBtn"> <a href="https://www.paypal.com/donate?hosted_button_id= <?php echo $buttonCode; ?> &source=url"> <button> <i class="fas fa-donate"></i> Donate </button> </a> </div> </div> </span> <?php endforeach; endif; ?> Sorry, should have just included this in the original post. It makes a lot more sense when you can see the whole structure of the cards. As you can see I'm using $count successfully in the $sectionText and $buttonCode variables (paragraph_$count and url_$count respectively). I've been using the variables this way in PHP for a while and have had zero issues thus far. Also, when I echo $goal and $raised in the span elements in my html they display the correct values. The current problem I'm experiencing isn't with using $count when declaring variables, it's when trying to typecast the values into integers directly below that. You suggested to use $page->raisedAmountCount to call fields, but you need to understand that by using $count here you are able to use a loop so that each time through it uses the next value (i.e. it's really grabbing $page->raisedAmount1, $page->raisedAmount2, etc. each run through it). I have numerous raisedAmount fields in my page (1-15) and listing them out individually would be incredibly inefficient. This is what i++ was created for, one of the several reasons anyways... If there is a more proper way to write that code and get the same results, efficiently, I'm all ears, but the way I am using those variables is working in all of the other declarations I've used them in, and from what I do understand about programming is exactly how you should use variables like that. Hopefully the full code will help make what I'm trying to do a bit easier to understand.
  14. I was hoping to be able to do this entirely in PHP but was having all kind of issues getting it to see my values as numbers instead of strings (got error messages because my PW debugging is currently set to true). I currently have about 10 cards that PW is generating that include thumbnails, descriptions, donation amounts (raised amounts and goal amounts), and donate buttons. What I was trying to do was take the goal amount divide it by the raised amount (using PHP) and simply insert that value into the Progress element's Value attribute. Sounded simple enough but I couldn't get PHP to simply divide those two fields. First I tried dividing the goal value by the raised value and inserting it into the value attribute, like so: <? php $raised = $page->get("raisedAmount$count"); $goal = $page->get("goalAmount$count"); $percent = $goalNum / $raisedNum; ?> <progress value="<?php echo $percent; ?>" max="100"></progress> Which gave me this error message: Uncaught TypeError: Unsupported operand types: string / string Then I tried converting the two strings to integers because apparently PHP couldn't detect they were numbers and do it, like so: <?php $raised = $page->get("raisedAmount$count"); $goal = $page->get("goalAmount$count"); $goalNum = (int) $goal; $raisedNum = (int) $raised; if ($raisedNum != 0) : $percent = $goalNum / $raisedNum; else: $percent = 0; endif; ?> <progress value="<?php echo $percent; ?>" max="100"></progress> but all of the progress bars remain at zero percent (not shown), even when I have values in some of the $raised variables. Please note, if I add this code: <?php echo $percent; ?> below the Progress element, it shows 0 on every single card, so the $percent is never calculated (as per the $percent = $goalNum / $raisedNum;) even though $raisedNum should not equal 0 during that iteration of the loop (the original code includes a loop, which I omitted to keep the code sections above smaller, notice the $count at the end of the $raised and $goal variable declarations). When the loop goes over "raisedAmount1" there is a value in there; however, after typecasting it to an integer ($raisedNum) the value is 0 for someodd reason instead of 40,000, which is what is in the $raisedAmount1 field in Processwire... I'm new to relatively new to PHP and Processwire and could really use some help on this one. Thanks in advance for any helpful replies!
  15. These issues should be fairly easy for any intermediate to advanced ProcessWire developer to answer. I'm new to PHP and relatively new to ProcessWire and just need a bit of help. What I'm trying to do is bring in a couple of cards from my Projects page to display on my home page. I finally got the code right to bring in the cards but right now they're using my original images instead of my resized "variations". So firstly, I would like to know how to reference the variations of my images instead of using the original. Secondly, I need to grab only four of the cards from the Project page and not import in all ten. It should be just two small changes to my code to do these things (I would imagine). Here is the code I currently have for that section: <?php // https://processwire.com/api/arrays/ // check if the array of images has items if (count($pages->get("/projects/")->images)) : // get array of images from the field $images = $pages->get("/projects/")->images; $count = 0; // iterate over each one foreach ($images as $image) : $count++; $sectionText = $pages->get("/projects/")->get("paragraph_$count"); $img = $image; $buttonCode = $pages->get("/projects/")->get("url_$count"); ?> <span id="card<?php echo $count?>" class="card"> <img class="cardThumb" src="<?php echo $img->url; ?>" alt="<?php echo $image->description; ?> Thumbnail" /> <div class="cardBody"> <div class="cardText"> <h2><?php echo $img->description; ?></h2> <?php echo $sectionText; ?> </div> <div class="primaryBtn"> <a href="https://www.paypal.com/donate?hosted_button_id= <?php echo $buttonCode; ?> &source=url"> <button> <i class="fas fa-donate"></i> Donate </button> </a> </div> </div> </span> <?php endforeach; endif; ?> Thanks in advance for any help!
  16. Okay, I'm a noob to PW, as well as this module, and cannot figure out how to simply loop through a few videos that I have in a textarea field. Here's the code I'm using (that's probably wrong): <?php foreach($page->videos as $video) { echo '<div class="lazyload">' . $video . '"></div>'; } ?> I get this error on my page and can't figure out how to fix it: : Invalid argument supplied for foreach() in I'm a noob with PHP too and haven't quite figured out the foreach loop yet. I've looked at the PW documentation but haven't (quickly) found anything that explains it in detail. Any help would be much appreciated. FYI, I'm using the module TextformatterVideoEmbed as well to parse the videos from Youtube. I basically just have them listed in my page's textarea like this: <p>https://youtu.be/x0AHpsFVC9w</p> <p>https://youtu.be/x0AHpsFVC9w</p> <p>https://youtu.be/x0AHpsFVC9w</p> <p>https://youtu.be/x0AHpsFVC9w</p> Obviously they'll be unique links once the page goes live. The TextformatterVideoEmbed module requires them to be in <p> tags before exporting them to the page or I would just use the <p> or some other tag in the template file.
  17. Got it! Worked like a charm thank you! It has to be inside <p> tags inside of the Processwire admin page, not the template file (just an FYI for anyone else having this problem).
  18. I just started using this module and am getting nothing but a Youtube URL in my page body. I have a simple template and am only trying to display one video right now but have double checked all of my settings and cannot figure out how to get the video to embed properly. I have the text formatter set to 'Video Embed for Youtube / Vimeo', a single url in a textfield on my page, and content type set to 'unknown/text'. It's not to complicated of a setup, or so it seemed, so I thought it would work immediately. Any ideas would be much appreciated.
  19. Actually the code was fine. I checked the source code of the page and realized that the menu was being output from the php just as it was on my home page. I realized that it wasn't being displayed because Jquery was loading on my home page (through my billboard include file) but not on my back page, while I am using it (Jquery) to hide and show my menu.... LOL Thanks for all of your help anyways!
  20. My objective wasn't to be rude, it was to kindly ask people like him to not respond if his post doesn't help solve the question posted. I respond to questions if I don't know the answer and would appreciate the same from other people. It clutters up forums when people start responding with answers that aren't correct or don't fix the problem. I just tried your code on my one of my child pages and the menu still does not show up....
  21. Please don't chime in if you can't help fix the issue.
  22. That didn't help me at all. Like I said I'm new to ProcessWire.... I tried replacing that statement with yours, as well as the other references to $page (because they were "undefined variables" after changing the first statement) and the menu still didn't show up on my child pages.
×
×
  • Create New...