I am using the zend google api library to retrieve a list of event from a public calendar. I am successfully able to retrieve the title, when, and content, but where is an empty array. Any documentation that I have found in the past 3 hours from Google, Zend or otherwise is terrible and does not give a list of possible values. The only documentation I can find on the location of the event is how to set it if you are creating an event.
How do I access the location?
<?php
foreach ($eventFeed as $event) :
?>
<li>
<div class="event_title">
<?php echo $event->title->text;?>
</div>
<div class="event_time">
<?php echo date('h:ia', strtotime($event->when[0]->startTime));?>
</div>
<div class="event_location">
<?php echo $event->where?>
</div>
<div class="event_description">
<?php echo $event->content->text?>
</div>
</li>
<?php
endforeach;
?>
$where=$event->Where;
foreach($where as $eventplace)
{
echo $eventplace;
}
It will give you location.
The main reason is that it gives the location value in array so we have to find it out manually....
Related
Basically, I am trying to display ratings (using kk star rating plugin) for different past bookings in my plugin. I am using do_shortcode() for different bookings with different ids. This is being echoed in a partial file.
<?php
/* GIVE RATINGS IF NOT ALREADY GIVEN */
if ($ratings_possible) {
echo do_shortcode("[kkstarratings id=" . $booking->id . "]");
?>
Here $booking->id is giving a unique booking id number based on which I am trying to get unique rating for each booking.
Issue
Currently, main file runs loop three times and this snippet does display stars perfectly, but of those three star-bar, last one is actually working. Last one accepts the ratings and updates the average, but the first two are not working. We can hover over all there stars-bar and click, but the only last one of it is actually working.
I have also used kk_star_ratings() method but same result.
More details
The following is a part of dashboard.php code. It is displaying every appointment/booking of a customer. Here $customer->future_bookings is displaying upcoming bookings (where obviously $ratings_possible is set to false). However, on $customer->past_bookings I have set $ratings_possible to true. Followed by the partial file that is responsible for each booking detail i.e. include('_booking_tile.php');
dashboard.php
<div class="customer-bookings-tiles">
<?php
foreach($customer->future_bookings as $booking){
$editable_booking = true;
$ratings_possible = false;
include('_booking_tile.php');
} ?>
</div>
<?php } ?>
<?php
if($customer->past_bookings){ ?>
<div class="latepoint-section-heading-w">
<h5 class="latepoint-section-heading"><?php _e('Past '.$appointterm, 'latepoint'); ?></h5>
<div class="heading-extra"><?php printf( __('%d '.$appointterm, 'latepoint'), count($customer->past_bookings)); ?></div>
</div>
<div class="customer-bookings-tiles">
<?php
foreach($customer->past_bookings as $booking){
$editable_booking = false;
$ratings_possible = true;
include('_booking_tile.php');
} ?>
</div>
Now, on the _booking_tile.php, it contains details of each booking like agent, time, status etc. Through $booking object we are getting the variables of a particular booking and their values and everything. Here is some part of code:
_booking_tile.php
<div class="customer-booking-info-row">
<span class="booking-info-label"><?php _e($agentterm, 'latepoint'); ?></span>
<span class="booking-info-value"><?php echo $booking->agent->full_name; ?></span></div>
<div class="customer-booking-info-row">
<span class="booking-info-label"><?php _e('Status', 'latepoint'); ?></span>
<span class="booking-info-value status-<?php echo $booking->status; ?>"><?php echo $booking->nice_status; ?></span></div>
</div>
<?php if ($editable_booking) { ?>
<div class="customer-booking-buttons">
<a href="<?php echo $booking->ical_download_link; ?>" target="_blank" class="latepoint-btn latepoint-btn-primary latepoint-btn-link">
<i class="latepoint-icon latepoint-icon-ui-83"></i>
<span><?php _e('Add to Calendar', 'latepoint'); ?></span>
</a>
<?php /* <i class="latepoint-icon latepoint-icon-ui-46"></i><span><?php _e('Edit', 'latepoint'); ?></span> */ ?>
<a href="#" class="latepoint-btn latepoint-btn-danger latepoint-request-booking-cancellation latepoint-btn-link" data-route="<?php echo OsRouterHelper::build_route_name('bookings', 'request_cancellation'); ?>">
<i class="latepoint-icon latepoint-icon-ui-24"></i>
<span><?php _e('Cancel', 'latepoint'); ?></span>
</a>
</div>
<?php } ?>
<?php /* GIVE RATINGS IF NOT ALREADY GIVEN */
if ($ratings_possible) {
echo do_shortcode("[kkstarratings id=" . $booking->id . "]");
?>
<?php } ?>
Resulting HTML code is perfectly fine, every rating-star (kk star plugin) has perfect code it has unique IDs meaning it should work fine. Moreover, as I said before when I insert three shortcodes with different IDs, it works fine.
That stars are displaying perfectly, but only the third one is actually working. When I click third one it records my rating and displays the average. While first two are not.
Stars work when I insert their shortcodes manually through WordPress. So it means that multiple shortcodes with IDs is possible.
Author provides kk_star_rating() function that can be used in the code, but it gives same result.
Only the last star is working others are just not recording anything. All three have same resulting HTML code except for the IDs which will be unique.
I will be happy to answer more of your questions.
Here's the screenshot, Third one is giving me the result when I click. But I can only hover over the first two and click multiple times with no result.
Screenshot
It was some sort of problem with the plugin. It was not compatible with newest version of WordPress. Used a different plugin and it worked fine. Calling multiple shortcodes through a loop worked perfectly.
Thanks to everyone who tried to help.
client using event expresso 3 to build an table to display list of the class they provide. but I need to create custom template instead the default one.
I look into their documentation, taking me really long time to understand, I have couple tried, but not able to make it work.
1. Location is not pulling
<?php $event_location = get_post_meta($post->ID, 'event_location', true); ?>
<div class="location">
<h5<?php echo $event_location; ?></h5>
</div>
2. I keep getting error from this line also.
error: undefined : $image_url['event_thumbnail_url']
<?php if ($image_url['event_thumbnail_url']) { ?>
<img id="" class="" src="<?php echo
$image_url['event_thumbnail_url']; ?>" <?php } ?>
My client purchased the plugin, so I don't have access to their support forum
Quick version: How do I output a taxonomy term ID in a views template? I just want the numeric ID value. This will be used as a link anchor.
Long version:
Scenario, I have a view which displays a list of taxonomy terms. That view has a Page and a Block. The Page view is set to display the Block view as a header. That Block view simply contains the taxonomy names. The Page view displays all of the taxonomy content.
I want the Block view list to anchor to the items in the Page view:
This view is already built, the missing part of the equation is getting the anchor links in place.
The view currently comprises 3 custom template files:
views-view-fields--categories--page.tpl.php
<article id="NEED THE TERM ID HERE">
<header>
<h2 class="flag-heading"><?php print $fields['name']->content; ?> <span>in association with <?php print $fields['field_sponsor']->content; ?> </span></h2>
</header>
<div class="table">
<div class="table-cell">
<?php print $fields['field_category_image']->content; ?>
</div>
<div class="table-cell">
<?php print $fields['description']->content; ?>
</div>
</div>
</article>
views-view-fields--categories--block.tpl.php
<li><?php print $fields['name']->content; ?></li>
views-view--categories--block.tpl.php
<ul>
<?php print $rows; ?>
</ul>
I've tried using a views contextual filter rewrite on the top block view links, with no luck.
All I need is the variable for the TERM ID - I've done a var dump of the available variables, I can see the TID in that list, but have no idea how to reference it in a views-view-fields template file and can find nothing online that answers this most simple of concepts.
Screenshots of the Page and Block view setup:
Finally won my argument that this jump list is completely redundant and stupid, so it'll be removed, however, I did manage to output the TID, which was fairly obvious, as these things often are...
views-view-fields--categories--block.tpl.php
<li>
<?php print $fields['name']->content; ?>
</li>
views-view-fields--categories--page.tpl.php
<article id="cat<?php print($view->result[$view->row_index]->tid); ?>">
<header>
<h2 class="flag-heading"><?php print $fields['name']->content; ?> <span>in association with <?php print $fields['field_sponsor']->content; ?> </span></h2>
</header>
<div class="table">
<div class="table-cell">
<?php print $fields['field_category_image']->content; ?>
</div>
<div class="table-cell">
<?php print $fields['description']->content; ?>
</div>
</div>
</article>
The variable is obviously in the view array, it was just a case of getting the index of the current view item.
Adding
<?php print $fields['tid']->content; ?>
should give you the TID in views-view-fields--xxx--page.tpl.php and --block.tpl.php
Make sure the fields are set to remove any default wrappers and you should be good to go.
I have this PHP function, which I use to display my userdata. If run once it will basicly display a div with the userdata in it.
function listings($fornavn, $efternavn, $email, $adresse, $tlf, $postnr, $city, $fodselsdag, $brugerid,$bartype,$idbar)
{
?>
<div class="container">
<span class="records" id="id-<?php echo $brugerid;?>">
<div class="customer bidDiv clearfix">
<?php if ($bartype=='temp_vip') { ?>
<ul>
<li>
<span class="actionSpan" id="<?php echo $brugerid;?>" value="<?php echo $idbar;?>">
<a class="edit-opt" id="godkend" href="#">GODKEND</a>
</span>
</li>
<li>
<span class="actionSpan" id="delete-<?php echo $brugerid;?>" value="<?php echo $bartype;?>">
<a class="delete-opt" id="delete" href="#">Afvis</a>
</span>
</li>
<?php }else{ ?>
<ul>
<li>
<span class="actionSpan" id="delete-<?php echo $brugerid;?>" value="<?php echo $bartype;?>">
<a class="delete-opt" id="delete" href="#">Slet</a>
</span>
</li>
<li>
<a class="edit-opt" href="editform.php?id=<?php echo $brugerid."&bartype=".$bartype;?>" rel="facebox">Rediger</a>
</li>
<?php if ($bartype =='vip'){?>
<li>
<a class="print-opt" href="print.php?id=<?php echo $brugerid;?>" rel="facebox">Print</a>
</li>
<?php }else{
// Dont render vip link
}}?>
</ul>
<p class="contact-data">
<?php echo $email;?><br>
Tlf.: <?php echo $tlf;?>
</p>
<div class="base-data">
<h4><?php echo ucwords($fornavn)." ".ucwords($efternavn);?></h4>
<p>Fødselsdag <?php echo $fodselsdag;?></p>
<address><?php echo ucwords($adresse) ." ". $postnr ." ". ucwords($city);?></address>
</div>
</div><!-- end customer -->
</div>
</span>
<?php
I mostly use this function in a loop, to display all users from my MySQL database, who has a specific relation to something else.
This is all working great. But currently it would pull all results at once. Right now I only have 5 members, so its no problem, but say I get 800 or 2000 members, the list of users would get very long.
So I want to implement some kind of limit on how many users it displays, but still be able to browse through all the users. Many sites use something like pages and split up the results that way. Links like:
[1] [2] [3] [Last page>>]
I can't figure out how to start doing this? How would I proceed?
Also looked into this Jquery plugin:
http://andersonferminiano.com/jqueryscrollpagination/
But it keeps reloading my PHP file which results in the Loops being restarted, and it simply displays the results over and over again endlessly.
Can someone help me with the logic behind creating this? Or better, point me in a direction where I could use the jquery pluging above - where it only loads the loop one time, and renders the results as I scroll.
Any help or pointers will be greatly appreciated!
Thanks
Jquery pagination by default will only break-up the given table into several tabs on the page, that is all the data is actually loaded. There are some that let you do an AJAX request to fetch the next page, to work in conjunction with your PHP code.
Ideally, you want to limit the query using LIMIT (number of rows in the result object) and OFFSET (Start from row X ) which will give you number of records starting from your offset row up until the limit, and then use logic on the PHP side to determine the maximum number of pages.
$page = $_POST["page"] * 25; // make sure that page 0 is the starting page or calculate
$SQL = "SomeQueryText LIMIT 25 OFFSET '$page'" ;
$result = query ($SQL);
Im created a custom block, with the below code, but im having some trouble turning the Group Title into an link, that will take the user back to the group at anytime.
Below is the code ive used, I thought active turns it into a link, but perhaps im being stupid.
<div class="active"><h2><?php print $group_title; ?></h2></div>
Below is the full code:
<?php $group_title = og_get_group_context()->title; ?>
<?php $group_nid = og_get_group_context()->nid; ?>
<?php $forum_link = og_forum_get_forum_container($group_nid); ?>
<div class="active"><h2><?php print $group_title; ?></h2></div>
<div class="content"
<div class="item-list">
<ul>
<li class="user-input-link"><a title="Add a new Forum topic"href="/node/add/forum?gids[]=<?php print $group_nid; ?>">Add a new forum topic</a>
</ul>
</div>
</div>
You need to create URL for it to work.
Here is the link to API with more info: http://api.drupal.org/api/drupal/includes--common.inc/function/l/6
<div class="active"><h2><?php print l($group_title, "node/{$group_nid}"); ?></h2></div>
You need to do an anchor tag, like:
<div><h2><?php print $group_title; ?></h2></div>
I don't know how to get the url in Drupal though..