Jump to content

spercy16

Members
  • Posts

    31
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

spercy16's Achievements

Jr. Member

Jr. Member (3/6)

3

Reputation

  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.
×
×
  • Create New...