• Resolved scribe257

    (@scribe257)


    I really need some help with this dont care how it works as long as it does
    not got a clue about Mysql or Php

    As i said Need help

    I have reciently set up a website for a club i am a member of
    the site is for all the clubs in the same area
    I use the WP_CALENDAR for a list of meetings and have had help with bits of it

    But the Writer of the plugin says the output i want cant be done with the available commands

    Have looked at the MYPHPADMIN and found the entries for the plugin Below is the tables
    and Fields that i think will be required to give the desired output

    the following headers are in the 2 tables:-

    WP_FSEVENTS:-
    eventid
    subject
    tsfrom
    description

    WP_FSEVENTS_CATS:-
    catid
    eventid

    I have the following Categories which i wish to use:- 3,4,5,12

    Some of the events are in “2” caregories
    i would like to get an output that give me something like this:-

    Subject, tsfrom, description From category 12 but only if in 3
    12 but only if in 4
    12 but only if in 5

    The reson i wish this format is the categories 3,4,5 are all regular monthly or bymonthly events in my calendar
    but category 12 only happens once a year and is a visit to the events in the cat 3,4,5, so i wish to show these
    special visits in a page for each category

    If anyone can help i would be greatfull tried the forums and even tried mysql queries my self but just cant do it

Viewing 15 replies - 1 through 15 (of 26 total)
  • I think this query will show category 12 if also in 3:

    SELECT events.*
    FROM WP_FSEVENTS events
    JOIN WP_FSEVENTS_CATS cats1 ON (events.eventid = cats1.eventid)
    JOIN WP_FSEVENTS_CATS cats2 ON (events.eventid = cats2.eventid)
    WHERE cats1.catid = 12
    AND cats2.catid = 3

    But, I can’t give specific code to put it in a template for your site without being able to see the theme’s code. If you are using a free theme, post a link to either your site or the theme’s site here and I will take a look.

    Thread Starter scribe257

    (@scribe257)

    Thread Starter scribe257

    (@scribe257)

    hi just tried your query works a treat SO thanks a lot how do i call this query from a page and get the results on the page if you can point me in the right direction i will be greatfull

    In general, the method is like this:

    <?php foreach (array(3,4,5) as $regcat) {
       $sql = "
          SELECT events.*
          FROM WP_FSEVENTS events
          JOIN WP_FSEVENTS_CATS cats1 ON (events.eventid = cats1.eventid)
          JOIN WP_FSEVENTS_CATS cats2 ON (events.eventid = cats2.eventid)
          WHERE cats1.catid = 12
          AND cats2.catid = $regcat";
       $annual_events = $wpdb->get_results($sql);
       echo '<div class="annual-events">';
       foreach ($annual_events as $annual_event) {
          echo "<h2>$annual_event->subject</h2>";
          echo "<p>$annual_event->tsfrom</p>";
          echo "<p>$annual_event->description</p>";
          echo '<br />';
       }
       echo '</div><!-- End annual-events -->';
    }
    ?>

    You must put this in code to provide the rest of the page layout. Since I am not familiar with the code that Artisteer generates, I can’t be much more help unless you can put the code for an event page in a pastebin and post a link to it here.

    Thread Starter scribe257

    (@scribe257)

    Sorry but can you explain what page you mean i will be creating a new page for the output the 3 different outputs will have text between them but so far i have not created the blank page yet if it is a page in my theme can you tell me wihich one it might be

    soory for all the problems but have learned some things already from your help

    I don’t know what files Artisteer generates. If there is a page.php file in your theme, put it in a pastebin and post a link here.

    I will convert it into a template. You will then put the template in your theme folder, create a blank Page, and assign the template to it.

    Thread Starter scribe257

    (@scribe257)

    hi here is the page.php from my theme/template directory
    pastebin
    hope this is the file you want
    starting to understand what has to be done now if i am right
    the code has to be put into the page and saved as a template the template is then used for the page requiring the data and then the data show in that page???
    Thanks

    You are correct:

    • the code is put in a template
    • the template is assigned to a page
    • when that page is selected, the data will show in it

    Your pastebin link does not lead to your code.

    Thread Starter scribe257

    (@scribe257)

    http://wordpress.pastebin.com/sb6FjCYz
    sorry had http 2 times didnt notice

    Here is a function to create a shortcode for your event list.

    Paste it to the end of your functions.php, leaving no blank lines between the current end and the start of this code. You might need to alter the code a little as some functions.php files do not want the opening <?php or the closing ?> tags.

    Create a page to display your data. Put whatever text you want in the page. At the point where you want the events for catid 3, put this shortcode:

    [mm-event catid=3]

    Put in similar shortcodes for catids 4 and 5.

    Publish the page and view it.

    Alter the code in the function to change the display to what you want.

    Thread Starter scribe257

    (@scribe257)

    function
    this is the function.php with the code incerted
    so what happensif i upload and it doesnt work will the site still work?

    thanks for all the help you have been fantastic

    Thread Starter scribe257

    (@scribe257)

    Parse error: syntax error, unexpected ‘<‘ in /homepages/20/d347976035/htdocs/wp-content/themes/pgrac/functions.php on line 716

    Thread Starter scribe257

    (@scribe257)

    crashed the site with the above error had to change the cats to 5,6,7,8 as i run the same site in a free host as a test site its now crashed totally but the above error is on the live site put the original file back and it works again

    Thread Starter scribe257

    (@scribe257)

    is the problem that <?php is opened before i incert code at line 716
    there is <?php line 717 has}

    dont know but think that could be the problem am i right??

    As I said earlier,

    some functions.php files do not want the opening <?php or the closing ?> tags.

    Take out both of those lines before you paste the code.

Viewing 15 replies - 1 through 15 (of 26 total)

The topic ‘Newbie needs myphpadmin help’ is closed to new replies.