Jump to content

n0sleeves

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by n0sleeves

  1. If by "not duplicated" you mean (only showing once), then yes, it only appears once in the SQL file. Sorry, my limited noob knowledge does not understand what constitutes pages I have one SQL file. Would you like to see the complete contents of it (it's pretty long)?
  2. Any other ideas? I want to start working on the new version as soon as possible, but can't until I get this working
  3. No offense taken. Yes, I am positive I am importing the old, exported, original database into the new, blank and empty db. I even created yet another db with a different name to see if that was the problem and still throwing the same error :/
  4. The new database is empty and doesn't show that. When I copied the project folder to a new folder, I also copied Processwire with it. No new installation.
  5. Using Wamp and PhpMyAdmin (Version information: 4.0.4) MySQL server (Server version: 5.6.12-log) Here's the steps I do: Select project_v1 database (the original database). Choose Export > Quick Export > SQL Format File saved Created a new database called project_v2, then select it Choose Import > I select previous exported file > Leave it on all default Settings Then this error pops up when I hit Go: Error SQL query: -- -- Dumping data for table `fieldgroups` -- INSERT INTO `fieldgroups` ( `id` , `name` ) VALUES ( 2, 'admin' ) , ( 3, 'user' ) , ( 4, 'role' ) , ( 5, 'permission' ) , ( 1, 'home' ) , ( 88, 'sitemap' ) , ( 83, 'basic-page' ) , ( 80, 'search' ) , ( 97, 'album' ) , ( 98, 'artist' ) , ( 99, 'artists' ) , ( 100, 'track' ) , ( 101, 'catalog' ) , ( 102, 'genres' ) , ( 103, 'genre' ) , ( 104, 'moods' ) , ( 105, 'mood' ) , ( 106, 'full-width' ) ; MySQL said: Documentation #1062 - Duplicate entry '2' for key 'PRIMARY'
  6. Mr-fan, I am now a fan because you are the man! It seemed too easy and too good to be true, but that totally worked!!! Thank you!! How come I have never seen this method mentioned in the books I am reading is beyond me Maybe reading the wrong books? lol. Is there a name for this?
  7. I'm following the FAQ post here / trying to create password protected page. The code they supplied was this: <?php if ($_POST['awesome_password'] != $page->page_password) { echo <<<EOT <h1>Login</h1> <form name='form' method='post' action='$page->url'> <input type='password' title='Enter your password' name='awesome_password' /> <br /> <input type='submit' name='Submit' value='Login' /> </form> EOT; } else { echo "<p>This is the protected page. Content goes here.</p>"; } ?> That works beautifully. However, I want to spit out more than just a simple ECHO in the else statement. In fact, I want some pretty simple Html mixed with php. Now I tried modifying the original code supplied by adding another <<< thinking that it would work but of course it didn't else { echo <<<EOD <!--Begin Table For Catalog Data --> <table id="catalog" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>Artist</th> <th>Track Name</th> <th>Album</th> <th>Length</th> <th>Songwriter(s)</th> <th>Genre</th> <th><span data-tooltip class="has-tip" title="Displays the following mood / emotion / characteristic">Traits</span></th> <th><span data-tooltip class="has-tip" title="All songs are originals unless designated cover (letter C)">Type</span></th> <th></th> </tr> </thead> <tbody> <?php //Table Loops $tracks = $pages->find("has_parent=/artists/, template=track"); if($tracks) { foreach($tracks as $track) { echo "<tr>"; echo "<td id='artistName'>" . $track->parent->parent->title . "</td>"; // artist name echo "<td id='trackTitle'>" . $track->title . "</td>"; echo "<td id='albumTitle'>" . $track->parent->title . "</td>"; // this is the album name echo "<td id='trackLength'>" . $track->track_length . "</td>"; // track length echo "<td>" . $track->songwriter . "</td>"; // track songwriter echo "<td id='genres'>"; foreach ($track->genres as $genre) { echo $genre->title . "/"; }; echo "</td>"; echo "<td id='traits'>"; foreach ($track->moods as $mood) { echo $mood->title . "/ "; }; echo "</td>"; echo "<td>"; // determin cover song or not if($track->song_type != null) { echo '<img id="logo" src="' . $config->urls->templates . 'img/letterC.png">'; } else { echo ""; }; //end determin cover echo "</td>"; echo "<td>" . "<a href=' " . $track->song_file->url . " ' class='sm2_button'>Play</a>" ."</td>"; echo "</tr>"; } } ?> </tbody> </table> <!-- End Catalog Table --> <!-- Initialize DataTable --> <script> $(document).ready(function () { $('#catalog').DataTable(); } ); </script> EOD; } ?> I have never worked with <<< Heredoc syntax before, Apparently you can't put whatever you want between it? No?
  8. Okay, before I say anything, I know I should be using Git. Yes. It would make my life easier, but I really don't want to right now. Plus, I want to use a new database instead of messing up the original. So, with that said: I have project 1 folder (contains active PW and site files). I exported the database and duplicated the folder. When I went to import the exported database into the newly created one, I get this error: #1062 - Duplicate entry '2' for key 'PRIMARY' Wtf? I thought it would be simple to just backup / import. Guess not I am not a SQL experienced user so I am lost. Tried googling but answers are too complicated. Help please
  9. That' what I was going to do as well, however this is for digital goods and apparently the client needs a unique code(sku) for each product created in Foxycart (since digital goods needs to be created on the Foxy backend). I just noticed that the ID does show in the URL when editing in the Processwire backend so I may just tell the client to look in the URL. However, I am still open to suggestions. Are you using just the ID for digital goods?
  10. The eCommerce software (Foxycart) I am using is asking for unique code for each item I add. So I will need a way to auto-generate a sky/code/whatever that the client can see in Processwire and then input into Foxycart. This is for the sale of music tracks and complete albums. The way I have it setup in Processwire is like this: Artist Name - Albums - Album Name - Track 1 name - Track 2 name - etc .... I was thinking of using just the ID of each track / album, but the ID isn't shown to the client using Processwire so that's a no-go unless I can find a way to have this displayed. What would you do? Ideas? I don't want the client randomly putting SKU codes in in order to avoid duplicated entries, etc.. So it would have to be unique. Thanks!
  11. Oh my goodness, I'm such a dope!! Why was I over-complicating it! That indeed does work and does so very simply! Thank you!!! I was probably converting the $track object again because I am a noob and a bad one at that! This is the second time I have seemed to over-complicate / over-think something in PHP. Did you ever experience this symptom when learning the language or while beginning programming? Super embarrassing, but so grateful. Thanks for not punishing me and still taking the time to show / teach me the correct code. Y May I ask something (since you pointed it out)? In the books I am reading, I haven't seen creating multi-dimensional arrays like the way you are showing below. I am interested if you could explain that part of the code in more detail please? Particularly, the second set of brackets? Is this a shortcut to creating such an array? $lyricsArray[$track->id]['title'] = $track->title; $lyricsArray[$track->id]['lyrics'] = $track->lyrics; Many thanks!!
  12. The code is showing just basic echo for example purposes, but I will be replacing them in production with <script></script> tags. With that said - what am I doing wrong? When on the album page, I want the album script to only be referenced in the html head, and when I am on the catalog page I want the catalog script, etc. However, it doesn't appear to be working and is just echoing "album page" on both. <?php if ($pages->find("template=album")) { echo "album page"; } elseif ($pages->find("template=catalog")) { echo "catalog page"; } ?>
  13. Not sure how to ask this, but basically I have an associative PHP array outputting a song ID and it's lyrics from PW using this code: It's being stored in the $lyricsArray variable <?php // Loop though album Tracks $numTracksContainingLyrics = 0; // How many contain lyrics? $lyricsArray = array(); // Create empty array to hold lyrics foreach ($albumTracks as $track) { $html = "<tr>"; $html .= "<td>"; $html .= "<a href='" . $track->song_file->url . "' class=''>" . $track->title . "</a>"; $html .= "</td>"; $html .= "<td>"; if ($track->lyrics != null) { // If lyrics field isn't empty $html .= '<a href="#" class="lyricCLicked" data-reveal-id="songID_' . $track->id . '">Lyrics</a>'; $numTracksContainingLyrics++; foreach ($track as $value) { $lyricsArray[$track->id] = $track->lyrics; } }; $html .= "</td>"; $html .= "<td>"; $html .= "<a href='#'>Buy</a>"; $html .= "</td>"; $html .= "</tr>"; echo $html; } ?> The PHP code for outputting those values mentioned above is below: What I'd like to do is also output the song title (commented in red in the code below). However, I don't know how to go about doing it using the simple arrays I have been constructing. <?php foreach ($lyricsArray as $key => $value) { $lyricModal = '<div id="songID_' . $key .'" class="reveal-modal small" data-reveal>'; $lyricModal = '<h2>' . //HOW DO I ALSO GET $track-title HERE??? . '</h2>'; $lyricModal .= $value; $lyricModal .= '<a class="close-reveal-modal">×</a>'; $lyricModal .= '</div>'; echo $lyricModal; } ?> Thank you for your help!
  14. OMG. I can't believe I forgot to include the code here I was rushing. My apologies. Below is the code, however, I have already received answer at Stack Xchange as kongondo has pointed out. However, just for reference for anyone here, I have included the problem in more detail and the solution The solution was to insert some letters in front of the ID numbers. Apparently - querySelectorAll doesn't like number-only (or leading-digit) ids. **What I was doing:** I have links generated from a PHP array which produce it's own unique ID which should point to it's own modal (popup window) div which has a matching ID to the link ID. The modals are also auto generated using a PHP array. I am receiving this error, which I am very unfamiliar with (noob). Not sure how to fix. The modal isn't working and I am using Foundation 5's reveal plugin. **PHP LINK ARRAY:** //more code above if ($track->lyrics != null) { // If lyrics field isn't empty $html .= '<a href="#" class="lyricCLicked" data-reveal-id="' . $track->id . '">Lyrics</a>'; $numTracksContainingLyrics++; foreach ($track as $value) { $lyricsArray[$track->id] = $track->lyrics; } } **MODAL DIV ARRAY** foreach ($lyricsArray as $key => $value) { $lyricModal = '<div id="' . $key .'" class="reveal-modal" data-reveal>'; $lyricModal .= $value; $lyricModal .= '<a class="close-reveal-modal">×</a>'; $lyricModal .= '</div>'; echo $lyricModal; } The Results are being written to HTML source. So, the arrays are working and generating. It's just giving me this "***Failed to Execute querySelectorALl on Document : #1042 is not a valid selector***. By the way, "1042" is one of the unique IDs being generated in case you were wondering.
  15. I'm receiving "failed to execute querySelectorAll on Document". What is that error and how do I fix it? Been researching google :/ No luck
  16. I have a repeating loop which displays tracks from an album with a link on each track pointing to lyrics which appear in a popup window. Well, that's what I want to do at least Here's the code which displays the track listings: <?php // Show Album Tracks $albumTracks = $page->children; foreach ($albumTracks as $track) { $html = "<tr>"; $html .= "<td>"; $html .= "<a href='" . $track->song_file->url . "' class=''>" . $track->title . "</a>"; $html .= "</td>"; $html .= "<td>"; if ($track->lyrics != null) { // LYRICS LINK $html .= "<a href='#' data-reveal-id='lyricPopup'>Lyrics</a>"; }; $html .= "</td>"; $html .= "<td>"; $html .= "<a href='#'>Buy</a>"; $html .= "</td>"; $html .= "</tr>"; echo $html; } ?> The link is pointing to a modal popup div below: <div id="lyricPopup" class="reveal-modal" data-reveal> <h2><?php echo $track->title; ?></h2> <?php ?> <a class="close-reveal-modal">×</a> </div> What I need to do is have each track's lyrics popup in the modal. Can anyone supply the code for setting up the multi-dimension array which keeps tracks of which song title (lyric link) was clicked so that the appropriate lyrics for that particular song (associated with that song) appear in the modal? I understand the concept of arrays, but multidimensional are out my league. Knowing which link was clicked and retrieving the associated content for it is also beyond me. Not sure where to start. Thanks!!!
  17. I would like to know what each of the Text Formatters do as well. Since only half of the OP's question was answered, can someone explain each one and what it's best used for / when? Would be super helpful for beginners not familiar.
  18. Wow, thank you Soma! Your post made a ton of sense! Thank you so much. I ended up doing exactly what you proposed. It will work well. I'll continue to study for the future what was mentioned here. When you say hash, are you talking about an array?
  19. // Show Artist Albums $albums = $page->children; //get albums of artist if($albums) { foreach($albums as $album) { echo "<li>"; //get the unique id of the album's page echo "<a href='#&id=" . $album->id . "' class='albumClicked'>" . "<img src='http://placehold.it/100x100&text=[album cover]'></a>"; echo "</li>"; } } ?> Okay, so I've been reading like mad (and it's 2 in the morning). I figured that if I assign $album->id as part of the URL when clicked, that would be enough to create a unique id for each album, correct? So now I'm onto passing that value into the processing script and also figuring out how to pass the album tracks as well. At least this very small step is done lol. I'm trying here!
  20. Thank you for the reply! If I was more experienced, I would probably have no trouble following the direction you are recommending. However, I am still not sure how to accomplish this specifically though (very, very inexperienced). I don't even know the correct syntax for JS/jQuery. If I had more time to learn all of this, I'd do it instead of being a PITA, because I like learning. The time isn't there I will pay someone $$ (through Paypal) if they can send me the code along with explanations to accomplish this. I will need everything since apparently my skillset isn't there. I will need detailed directions though. Please inbox me. If this can be done today, that would be fantastic. I figure this shouldn't take more than an hour or two at max to put together. I'll throw $50 your way. Thank you.
  21. I have included a screenshot of the prototype I am building right now. It's self explanatory but to break it down: I have different albums on a page. On that same page is a section for the track listings showing for whichever album is clicked. What I want to do seems simple: Update the track listings depending on which album is clicked. Have the new tracks come in / appear smoothly (animated). I think this is called easing or something? What I need to know: Which technologies do I use for this? I'm thinking it's Javascript / jQuery? Maybe Ajax? How do I pull the data into it? Can you please supply me with sample code or send me to a forum that can? (My programming sucks really bad). Even though I would normally be very willing, I don't have very much time to learn / research as I only have a few days left for this project and still have many more things to setup. I already have some sample albums / tracks created in the PW backend. Thank you so very much!
×
×
  • Create New...