want to implement the desoslider in my website - osclass

my web site is using osclass classified script and i want to implement the desoslider in my website and i followed the [http://sylouuu.github.io/desoslide/documentation.html#setup][1]
the code and script i have used is below
PHP
<?php if( osc_images_enabled_at_items() ) { ?>
<?php if( osc_count_item_resources() > 0 ) { ?>
<div id="photos">
<?php for ( $i = 0; osc_has_item_resources(); $i++ ) { ?>
<a href="<?php echo osc_resource_url(); ?>" rel="image_group" title="<?php _e('Image', 'modern'); ?> <?php echo $i+1;?> / <?php echo osc_count_item_resources();?>">
<?php if( $i == 0 ) { ?>
<img src="<?php echo osc_resource_url(); ?>" width="70" height="50" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
<?php } else { ?>
<img src="<?php echo osc_resource_thumbnail_url(); ?>" width="70" height="50" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
<?php } ?>
</a>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<div id=demo></div>
JS
$(function() {
$('#photos').desoSlide({
main: {
container: '#demo',
cssClass: 'img-responsive'
},
caption: true
});
});
the document says that we have to specify your images links and the alt attribute. i tried several steps but no success. help me to successfully use this desoslider

Because in 1.* versions your thumbnails must be inside an <ul> tag with <li>. So replace <div id="photos"> by <ul id="photos"> and wrap <a> within <li>.
But anyway, this mandatory markup structure has been changed, the version 2 is more permissive. Check it out: http://sylouuu.github.io/desoslide/doc/

Related

use of email format in yii

I am able to send simple email to receiver.Now i have to be able to select a email format from existing different formats and this template must appear in my message box.i should also be able to change the content of the template that appears in message box before sending to receiver.How to do this?
My code for view form
<div class="form wide">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'mail-form',
'enableAjaxValidation'=>true,
'htmlOptions' => array('enctype' => 'multipart/form-data'), // ADD THIS
)); ?>
<div class="row col2">
<?php echo $form->labelEx($model,'email_from'); ?>
<?php echo $form->textField($model,'email_from',array('size'=>50,'maxlength'=>50,'readonly'=>'readonly')); ?>
<?php echo $form->error($model,'email_from'); ?>
</div>
<div class="row col2">
<?php echo $form->labelEx($model,'email_to'); ?>
<?php echo $form->textField($model,'email_to',array('size'=>50,'maxlength'=>50)); ?>
<?php echo $form->error($model,'email_to'); ?>
</div>
<div style="clear:both"></div>
<div class="row col2">
<?php echo $form->labelEx($model,'subject'); ?>
<?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>250)); ?>
<?php echo $form->error($model,'subject'); ?>
</div>
<div style="clear:both"></div>
<div class="row col2">
<?php echo $form->labelEx($model,'message'); ?>
<?php echo $form->textArea($model,'message',array('style'=>'width: 680px; height: 300px;')); ?>
<?php echo $form->error($model,'message'); ?>
</div>
<div style="clear:both"></div>
<div class="row buttons">
<?php
echo CHtml::submitButton($model->isNewRecord ? 'Send' : 'Send',array('class' => 'btn'));
?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
Try below code:
public function actionContact() {
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$status = Yii::$app->mailer->compose()
->setTo($model->email_to)
->setFrom([$model->email_from => $model->email_from])
->setSubject($model->subject)
->setTextBody($model->message)
->send();
if ($status) {
Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
} else {
Yii::$app->session->setFlash('error', 'There was an error sending email.');
}
return $this->refresh();
} else {
return $this->render('contact', [
'model' => $model,
]);
}
}
You can also create a email_template directory under views folder and create template file in which you can set email template content.
you can use js or ajax to do the same.
1: Use jQuery:
I assume that you are using jQuery. So use ajax.
.......JS Cod........
/*I assume that you have your template data in an attribute like data-template-data=""*/
$('#select_template_id').chang(function(){
template=$(this).attr('data-template-data');
$('#template_edit_box').val(template);
});

Issue to open dialog: Yii

I have used ajaxSubmitButton in my form.On click of button i am trying to open dialog When i click the button ,the dialog opens and it displays entire code written for that form . How to resolve this?
my code for button is :
<div class="btnalign" style="margin-top: 20px;margin-left:20px;">
<?=CHtml::ajaxSubmitButton('Mail to Client', Yii::app()->createUrl('reply/composeMail'),
array('type'=>'POST',
'data'=> 'js:{"data1":callData()}',
//'success' => 'function(response){afterSubmitForm(response);}'
'success'=>'js:function(string){ alert(string);$.fn.yiiGridView.update("my-grid"); }'
),
array('class' => 'btn btn-primary'));
?>
</div>
my controller code:
public function actionComposeMail()
{
if(Yii::app()->request->isAjaxRequest){
print_r($_POST['data1']);
if(isset($_POST['data1'])){
$model=new Reply;
$model->scenario = 'compose';
EQuickDlgs::render('_compose',array(
'model'=>$model,
));
}else{
echo "Please select row to Mail.";
}
}
else
{
echo "The request is invalid.";
}
}
my dialog form code is:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'reply-form',
'enableAjaxValidation'=>true,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.For multiple recipients please seperate by comma</p>
<?php echo $form->errorSummary($model); ?>
<div class="row col2">
<?php echo $form->labelEx($model,'email_from'); ?>
<?php echo $form->textField($model,'email_from',array('size'=>50,'maxlength'=>50,'readonly'=>'readonly')); ?>
<?php echo $form->error($model,'email_from'); ?>
</div>
<div class="row col2">
<?php echo $form->labelEx($model,'email_to'); ?>
<?php echo $form->textField($model,'email_to',array('size'=>60,'maxlength'=>150)); ?>
<?php echo $form->error($model,'email_to'); ?>
</div>
<div style="clear:both"></div>
<div class="row col2">
<?php echo $form->labelEx($model,'email_cc'); ?>
<?php echo $form->textField($model,'email_cc',array('size'=>60,'maxlength'=>250)); ?>
<?php echo $form->error($model,'email_cc'); ?>
</div>
<div class="row col2">
<?php echo $form->labelEx($model,'subject'); ?>
<?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>250)); ?>
<?php echo $form->error($model,'subject'); ?>
</div>
<div style="clear:both"></div>
<div class="row">
<?php echo $form->labelEx($model,'message'); ?>
<?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>50)); ?>
<?php echo $form->error($model,'message'); ?>
</div>
<div style="clear:both"></div>
<div style="clear:both"></div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Send' : 'Send',array('class' => 'btn')); ?>
</div>
<?php $this->endWidget(); ?>
Image of dialog
You must use renderPartial() instead of render() and try to call Yii::app()->end() at the end in your mail form view
public function actionComposeMail()
{
if(Yii::app()->request->isAjaxRequest){
print_r($_POST['data1']);
if(isset($_POST['data1'])){
$model=new Reply;
$model->scenario = 'compose';
$this->renderPartial('_compose',array(
'model'=>$model,
));
}else{
echo "Please select row to Mail.";
}
}
else
{
echo "The request is invalid.";
}
}

dijit.layout.ContentPane shifts right on page load

I have a problem which I am unable to fix, maybe somebody can help?
I have a dijit.layout.ContentPane at the top of my page, this sits in a dijit.layout.BorderContainer. On page load the contents of the container shift right and down by about 15px. All other elements work fine.
I have isolated the issue to dijit.layout.ContentPane. In side the container I am running some php if statements and drawing some simple buttons:
<!-- Here are the common buttons above the tabs -->
<div id="toolPane" dojoType="dijit.layout.ContentPane" region="top" >
<?php
if($this->restrict == 1){
if($this->teammembers == 1 || $this->newleaders == 1 || $this->newadminleaders == 1){
if ($this->mayUpdateSummary){
?><span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue, 'Create report', 'report', 'reportLink'); ?></span>
<span style="white-space:nowrap;" ><a class="emailLink" href="mailto:?subject=Task%20%23<?php echo $issue->id; ?>&body=<?php echo urlencode($this->serverUrl(true)); ?>">Share link</a></span><?php
}
}
}else if($this->restrict == 2){
if ($this->mayUpdateSummary){
?><span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue, 'Create report', 'report', 'reportLink'); ?></span>
<span style="white-space:nowrap;" ><a class="emailLink" href="mailto:?subject=Task%20%23<?php echo $issue->id; ?>&body=<?php echo urlencode($this->serverUrl(true)); ?>">Share link</a></span><?php
}
}
?>
<?php if ($this->mayUpdateSummary): ?>
<span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue,'Edit summary', 'progress-summary', 'editbutton'); ?></span>
<?php endif; ?>
<?php if ($closeButton): ?>
<span style="white-space:nowrap;" ><?php echo $closeButton; ?></span>
<?php endif; ?>
<?php if ($reopenButton): ?>
<span style="white-space:nowrap;" ><?php echo $reopenButton; ?></span>
<?php endif; ?>
</div>
Ok, we have decided to hide the page until the dijit elements have loaded. To do this we have added this script which fades in the page giving it time to sort itself out before it is displayed:
<script type="text/javascript">
$(document).ready(function(){
$(".content").hide();
});
$(window).load(function(){
$(".content").fadeIn("fast");
});
</script>
<div class="content">
[faded in content goes here]
</div>

Instagram's geotagging API

I'm working on learning about Instagram's API as a side project. I've followed this tutorial (http://eduvoyage.com/instagram-search-app.html) to implement a search feature by hashtag. It was extremely helpful to me. One of the things I saw in the API was the location ID feature, and I was wondering how to implement that. Through a search on this site, I found that a request can be made which will return the following.
'{
"meta": {
"code": 200
},
"data": {
"attribution": null,
"tags": [],
"type": "image",
"location": {
"latitude": 48.8635,
"longitude": 2.301333333
},
"comments": {
"count": 0,
"data": []
},
..........'
I'm trying to figure out this tutorial to process that information. (http://www.ibm.com/developerworks/xml/library/x-instagram1/index.html#retrievedetails)
<html>
<head>
<style>
</head>
<body>
<h1>Instagram Image Detail</h1>
<?php
// load Zend classes
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
// define consumer key and secret
// available from Instagram API console
$CLIENT_ID = 'YOUR-CLIENT-ID';
$CLIENT_SECRET = 'YOUR-CLIENT-SECRET';
try {
// define image id
$image = '338314508721867526';
// initialize client
$client = new Zend_Http_Client('https://api.instagram.com/v1/media/' . $image);
$client->setParameterGet('client_id', $CLIENT_ID);
// get image metadata
$response = $client->request();
$result = json_decode($response->getBody());
// display image data
?>
<div id="container">
<div id="info">
<h2>Meta</h2>
<strong>Date: </strong>
<?php echo date('d M Y h:i:s', $result->data->created_time); ?>
<br/>
<strong>Creator: </strong>
<?php echo $result->data->user->username; ?>
(<?php echo !empty($result->data->user->full_name) ?
$result->data->user->full_name : 'Not specified'; ?>)
<br/>
<strong>Location: </strong>
<?php echo !is_null($result->data->location) ?
$result->data->location->latitude . ',' .
$result->data->location->longitude : 'Not specified'; ?>
<br/>
<strong>Filter: </strong>
<?php echo $result->data->filter; ?>
<br/>
<strong>Comments: </strong>
<?php echo $result->data->comments->count; ?>
<br/>
<strong>Likes: </strong>
<?php echo $result->data->likes->count; ?>
<br/>
<strong>Resolution: </strong>
<a href="<?php echo $result->data->images
->standard_resolution->url; ?>">Standard</a> |
<a href="<?php echo $result->data->images
->thumbnail->url; ?>">Thumbnail</a>
<br/>
<strong>Tags: </strong>
<?php echo implode(',', $result->data->tags); ?>
<br/>
</div>
<div id="image">
<h2>Image</h2>
<img src="<?php echo $result->data->images
->low_resolution->url; ?>" /></a>
</div>
<div id="comments">
<?php if ($result->data->comments->count > 0): ?>
<h2>Comments</h2>
<ul>
<?php foreach ($result->data->comments->data as $c): ?>
<div class="item"><img src="<?php echo $c
->from->profile_picture; ?>" class="profile" />
<?php echo $c->text; ?> <br/>
By <em> <?php echo $c->from->username; ?></em>
on <?php echo date('d M Y h:i:s', $c->created_time); ?>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
<?php
} catch (Exception $e) {
echo 'ERROR: ' . $e->getMessage() . print_r($client);
exit;
}
?>
</body>
</html>
The main problem (I think) that I'm having is here:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
I downloaded Zend Frame 1.12.13, but I'm not sure what these line of code is asking for. In the Zend Framework folder, It goes "Zend/Loader(Folder)", but nothing called "Loader.php". Does that just load everything in the 'Loader' folder? Same for the Zend_Loader, there is a directory of Zend/Http/Client, but Client is also a folder.
tl;dr
Trying to set up a program that will search instagram (as linked in the tutorial above), be able to click on the picture results, open one tab that shows the picture and the users profile, and another tab that shows all the image metadata. Is there a simpler way to do this? Or a more noob friendly tutorial?
I ran into a similar problem when using this example. You must include the path of the Zend framework at the very top of this example. I did it in just its own php block at the top.
ini_set('include_path', 'path/to/ZendFramework/library');

Joomla module position with Yt framework

I am working with a Joomla 2.5 template called Sj_news25 - see the demo here http://demo.smartaddons.com/templates/joomla17/sj-news/
What I want to do is create a module position somewhere between the logo and the search box, so I can fit a language switcher flags there. I have previously used a tutorial on http://docs.joomla.org/How_do_you_add_a_new_module_position%3F and that has worked fine, but this template uses a so-called "Yt Framework" and when I look at the index.php file, I'm stumped. Is there anyone here who could venture a guess? Thanks!
<?php
/****************************************************************************************
* #copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* #license GNU/GPL, see LICENSE.php
* Yt Framework
****************************************************************************************/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
include_once (dirname(__FILE__).DS.'includes'.DS.'yt_template.class.php');
include_once (dirname(__FILE__).DS.'includes'.DS.'frame_inc.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" <?php echo ($ytrtl == 'rtl')?'dir="rtl"':''; ?> lang="<?php echo $this->language; ?>">
<head>
<jdoc:include type="head" />
</head>
<body id="<?php echo $yt->template; ?>" class="<?php echo $yt->isHomePage()?'homepage ':'';
echo isset($_GET['option'])?$_GET['option'].' ':'';
echo isset($_GET['view'])?'view-'.$_GET['view'].' ':'';
echo $yt->getParam('sitestyle').' ';
echo $ytrtl=='rtl'?'rtl'.' ':'';
echo $yt->getParam('menustyle').' ';
echo 'fs'.$yt->getParam('fontsize'); ?>">
<div id="yt-wrapper"><div id="yt-wrapper-inner1"><div id="yt-wrapper-inner2">
<?php
// add mobile head
if( $yt->is_mobile ){
include_once (dirname(__FILE__).DS.'includes'.DS.'mobile_head.php');
}
?>
<a id="top" name="scroll-to-top"></a>
<?php
foreach($yt_render->arr_TB as $tagBD): if( $tagBD["countModules"] > 0 ){
if( ($tagBD["name"] == 'content') ){ // Block content - #content ?>
<div id="<?php echo $tagBD["id"]; ?>" class="<?php echo $yt_render->layouttype.$tagBD['class_content'];?>">
<?php
//
if($tagBD['showDivTop']=='1'){ ?>
<div class="yt-main yt-div-top-1"><div class="yt-div-top-2"><div class="yt-div-top-3"></div></div></div>
<?php } ?>
<div class="yt-main"><div class="yt-main-in1"><div class="yt-main-in2 clearfix">
<?php
$countL = $countR = $countM = $countCL1 = $countCL2 = 0;
foreach($tagBD['positions'] as $position):
if( isset($position['column']) && $position['column'] == 'yt-col1' ){
$countCL1++;
if($countCL1==1){
?>
<div id="yt-col1" style="float:left; width:<?php echo $yt_render->cinfo['w-yt-col1']; ?>;<?php echo $yt_render->cinfo['display-yt-col1']; ?>">
<?php
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
if($tagBD['count-yt-col1']==1){
?>
</div>
<?php
}
}elseif( $countCL1==$tagBD['count-yt-col1'] && $tagBD['count-yt-col1']>1 ){
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
?>
</div>
<?php
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
}elseif( isset($position['column']) && $position['column'] == 'yt-col2' ){
$countCL2++;
if($countCL2==1){
?>
<div id="yt-col2" style="float:right; width:<?php echo $yt_render->cinfo['w-yt-col2']; ?>;<?php echo $yt_render->cinfo['display-yt-col2']; ?>">
<?php
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
if($tagBD['count-yt-col2']==1){
?>
</div>
<?php
}
}elseif( $countCL2==$tagBD['count-yt-col2'] && $tagBD['count-yt-col2']>1 ){
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
?>
</div>
<?php
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
endforeach; //End foreach position of block content
?>
</div></div></div>
<?php
//
if($tagBD['showDivBottom']=='1'){ ?>
<div class="yt-main yt-div-bottom-1"><div class="yt-div-bottom-2"><div class="yt-div-bottom-3"></div></div></div>
<?php } ?>
</div>
<?php
}elseif($tagBD["name"] != 'content'){ // Block is not content
?>
<div id="<?php echo $tagBD["id"]; ?>">
<div class="yt-main"><div class="yt-main-in1"><div class="yt-main-in2 clearfix">
<?php
if( !empty($tagBD["hasGroup"]) && $tagBD["hasGroup"]=="1"){ // Tag Body has group
$flag = ''; $openG = 0; $c = 0;
foreach( $tagBD['positions'] as $posFG ): $c = $c+1;
if( $posFG['group'] != "" && $posFG['group']!= $flag){
$flag = $posFG['group'];
if($openG == 0){ $openG =1;?>
<div class="group-<?php echo $flag.$tagBD['class_groupnormal'];?> clearfix" style="<?php echo isset($tagBD['width-'.$flag])?'width:'.$tagBD['width-'.$flag].'; ':'' ; ?><?php echo $float1;?>">
<?php
echo $yt->renPositionGroup($posFG);
if($c == count( $tagBD['positions']) ){echo '</div>';}
}else{
$openG = 0;
?>
</div>
<div class="group-<?php echo $flag; ?>" style="width:<?php echo $tagBD['width-'.$flag]; ?>; <?php echo $float1;?>">
<?php
echo $yt->renPositionGroup($posFG);
}
}elseif($posFG['group']!="" && $posFG['group'] == $flag){
echo $yt->renPositionGroup($posFG);
if($c == count( $tagBD['positions']) ){echo '</div>';}
}elseif($posFG['group']==""){
if($openG ==1){
$openG = 0;
echo '</div>';
}
echo $yt->renPositionGroup($posFG);
}
endforeach;
}else{ //Tag Body normal
if(isset($tagBD['positions'])){
if(isset($tagBD['autosize'])){
echo $yt->renPositionNormals($tagBD['positions'], $tagBD["countModules"], $tagBD["limited"], $tagBD['autosize']);
}else{
echo $yt->renPositionNormals($tagBD['positions'], $tagBD["countModules"], $tagBD["limited"]);
}
}
}
?>
</div></div></div>
</div>
<?php
} // end elseif($tagBD["name"] != 'content')
}
endforeach;
?>
</div></div></div>
<jdoc:include type="modules" name="debug" />
<?php
if( !$yt->is_mobile && $yt->getParam('showCpanel') ) {
include_once (dirname(__FILE__).DS.'includes'.DS.'cpanel.php');
}
?>
</body>
</html>
<?php /*}*/ ?>
Please go to file: your_template/layouts/layout-homepage.xml(or current layout) replace code:
#logo
header1
by:
#logo
your_position
header1
You can find out more about Yt Framework here: http://www.smartaddons.com/joomla/templates/yt-framework