I created a listview that has a count bubble and a desription of the item for each li. The problem is that the text for the description falls behind the count bubble. Is this a glitch or something I can correct with css?
echo '<li><a value="' . $row['product_id'] . '" data-icon="arrow-r" data-iconpos="right"><img src="images/' . $row['product_picture_name'] . '.png">' . '<h3>' . $row['product_name'] . '</h3><p style="white-space:normal">' . $row['product_description'] . '</p><span class="ui-li-count">Price: $' . $row['product_price'] . '</span></a></li>';
Thanks, Adam.
I ended up adding the width property to the p tag of 90%, and the text will start wrapping before it gets to the count bubble position and it scales with different screens sizes.
echo '<li><a value="' . $row['product_id'] . '" data-icon="arrow-r" data-iconpos="right"><img src="images/' . $row['product_picture_name'] . '.png">' . '<h3>' . $row['product_name'] . '</h3><p style="white-space:normal; **width:90%;**">' . $row['product_description'] . '</p><span class="ui-li-count">Price: $' . $row['product_price'] . '</span></a></li>';
Related
I have a very weird problem and I would really appreciate your help with it.
I am using wp_insert_post when a user submits a post. It works fine when I submit the form (i.e. the admin of the wordpress site), but when I try the same thing with a different user (i.e. different email, not the admin of the wordpress site), it only shows part of the content I used in the post_content field.
my code:
$my_post = array(
'post_title' => 'My bet',
'post_content' => '<form action="" method="post" id=form_id>' . 'bet ID: ' . '<input readonly id=betid type=text value=' . $bet_id . '>' . '<input id=url name=urlpath type=hidden value=>' . '</form>' ."\r\n match: " . '<span id=match>' . $_POST[event] . '</span>' . "\r\n" . $current_user->user_login . "'s Pick: " . $_POST[bet] . '</span>' . '<span id=friends>' . '</span>' ."\r\n Amount: " . '<span id=amount>' . $_POST[amount] . '</span>' . "<?php include('wp-content/themes/twentyfourteen/test.php') ?>"
'post_status' => 'publish');
When it is executed for the wordpress admin user (user ID=1) it works fine. when it is executed for any other user (user ID!=1) it is not showing the input fields of the form, and more important, not including the test.php I have included.
I've seen some variations of this question around, but I've as of yet been unable to tweak them into what I'm looking for.
In a Wordpress post, if an image is uploaded with a caption the image will be output wrapped in a div (with class wp-caption). Perfect.
However, if there is no caption the image is wrapped in a paragraph tag. I'd like to replace this with a div.
So if an image is uploaded without a caption, it is wrapped in a div as well — something like class="wp-nocaption".
My first try was to modify the media.php file. I changed this section:
if ( 1 > (int) $width || empty($caption) )
return $content;
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return '<div ' . $id . 'class="wp-caption ' . esc_attr($align)
. '" style="width: ' . (10 + (int) $width) . 'px">'
. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
to this:
if ( 1 > (int) $width || empty($caption) )
return '<div ' . $id . 'class="wp-nocaption ' . esc_attr($align)
. '" style="width: ' . ($width) . 'px">'
. do_shortcode( $content ) . '</div>';
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return '<div ' . $id . 'class="wp-caption ' . esc_attr($align)
. '" style="width: ' . ($width) . 'px">'
. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
Which I hoped would do the same thing for a non-captioned image as a captioned one, except the div would have a different class.
But that didn't work. Does anyone have any idea why?
I also found some articles suggesting using a preg_replace function.
http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/
https://wordpress.stackexchange.com/questions/7090/stop-wordpress-wrapping-images-in-a-p-tag
I tweaked their functions, attempting to replace paragraph tags that wrap an image wrapped in a link with div tags.
function filter_ptags_on_images($content) {
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU',
'/<div class="wp-nocaption">\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/div>/iU',
$content);
}
add_filter('the_content', 'filter_ptags_on_images');
But this doesn't work. I've been reading a lot but still can't wrap my head around the php concept of "backreference". I know the replace section of my function is wrong, but I'm not sure how to fix it.
If you have any suggestions as to what I'm doing wrong on either way would be very much appreciated!
Thank you so much!!
I am using Dynamic Time Warping to find the segments of the trajectory which do not match with the template trajectory .
Template Trajectory :
. . .
. .
. .
. .
. . .
.
Test Trajectory :
.
. .
. .
. .
. .
. .
. . .
.
Using Dynamic Time Warping , i find the following points that do not match (marked with asterisk )
*
* *
. .
. .
. .
. .
. . .
.
Now i want to enlarge the mistake what i do is ,
i multiply the x and y co-ordinates of the mistakes(non matched) points by a factor
x=x*1.2;
y=y*1.2;
this gives me a deformed trajectory like this :
*
* *
. .
. .
. .
. .
. . .
.
but i want a smooth trajectory , in which all the points are changed and the mistakes enlarged . something like this :
*
* *
. .
. .
. .
. .
. . .
.
How can i do this ?
PS:I really wasn't able to think of a simple way to describe the problem i am having. I am using C++ , if in anyway in explaining your solution .
Define A(t) as the displacement vector at time=t. The displacement vector for each point is then its position vector (x,y) minus the previous position vector.
Scale these vectors up to get your scaled error vector, and then move from point to point by adding the vectors together. This will shift not only the range (y-axis) of the errors, but also the domain (x-axis) so it will look smooth.
Any use?
How do I use this API? I can extract some data, but not all of it... I'm a bit lost and I can't find any examples in the documentation. I'm using gapi.class.php.
I have code such as:
$ga = new gapi('user','pwd');
$ga->requestReportData('id',array('browser'),array('pageviews','visits', 'timeOnSite'));
var_dump($ga);
foreach($ga->getResults() as $result)
{
print_r($result);
echo '<strong>'.$result.'</strong><br />';
echo 'Pageviews: ' . $result->getPageviews() . ' ';
echo 'Visits: ' . $result->getVisits() . '<br />';
echo 'Time On site: ' . $result->getTimeOnSite() . '<br />';
}
echo '<p>Total pageviews: ' . $ga->getPageviews() . ' total visits: ' . $ga->getVisits() . '</p>';
The above is working, but then I also want to get other data such as goals... I see this: http://code.google.com/intl/es-ES/apis/analytics/docs/gdata/dimsmets/dimsmets.html
but I'm not really sure how to call each function, or property... I'm really lost, any examples would be appreciated!
GAPI uses magic get methods. You put in the dimensions and metrics that you want and get them using the magic get methods.
For example:
$ga = new gapi('user','pwd');
$ga->requestReportData('id',array('browser'),array('pageviews','visits', 'timeOnSite'));
foreach($ga->getResults() as $result)
{
print_r($result);
echo '<strong>'.$result.'</strong><br />';
echo 'Pageviews: ' . $result->getPageviews() . ' ';
echo 'Visits: ' . $result->getVisits() . '<br />';
echo 'Time On site: ' . $result->getTimeOnSite() . '<br />';
}
echo '<p>Total pageviews: ' . $ga->getPageviews() . ' total visits: ' . $ga->getVisits() . '</p>';
array('browser') is the dimension and array('pageviews','visits', 'timeOnSite') are the metrics. $result->getPageviews() is the magic get method for the pageviews metric.
So, refer to the list and put in the dimensions and metrics you want then return them using the magic get methods of getYourdimension or getYourmetric. Note that get is lowercase and the dimension or metric begins with a capital letter.
See the documentation for more information:
Access metrics and dimensions using magic get methods
With GAPI, when data is returned from Google it is automatically converted into a native PHP object, with an interface to allow the 'get' the value of any dimesion or metric.
For example, if you request the metric 'uniquePageviews' and the dimesion 'pagePath' you can do the following:
foreach($ga->getResults() as $result)
{
echo $result->getUniquePageviews();
echo $result->getPagePath();
}
To get a list of a content type's cck fields, I was hoping to use:
drupal_get_schema('content_type_mycontenttype');
but that leaves out fields with multiple values. Is there a simple call to use to get such a list?
Take a look at the content_fields function, and if doesn't that have the information you need, there is _content_type_info.
Additionally, once you have the field information, you can extract the table storage and column names using content_database_info.
For Drupal 7, check out the field_info_instances function to retrieve a list of fields for a particular node content type.
Here is an example usage that will retrieve all the fields for a node content type.
$my_content_type_fields = field_info_instances("node", "my_node_content_type");
I've used something like this before to do a quick list of CCK Field information for a content type:
$mytype = 'article';
$contentinfo = _content_type_info();
$output .= "<ul>";
foreach($contentinfo['fields'] as $field) {
if ($field['type_name'] == $mytype) {
$output .= '<li id="field-' . $field['field_name'] . '">' . $field['widget']['label'] . '<br>';
if ($field['widget']['description']) {
$output .= $field['widget']['description'] . '<br>';
}
$output .= '<ul>
<li>Content Types: ' . $field['type_name'] . '</li>
<li>Type: ' . $field['type'] . '</li>
<li>' . $field['field_name'] . '</li>
</ul>';
}
}
$output .= '</ul>';