I hope you can help me. Google map does not work and I would like to replace google maps with a background image. How do I do that?
Are there some who can show me? I´m not so good at php and it is some code in wordpress.
My code:
<section id="contact">
<!-- map -->
<div id="gmap_canvas"></div>
<?php
global $tlazya_evential;
$glat = $tlazya_evential['map_lat'];
$glng = $tlazya_evential['map_lng'];
$gzoom = $tlazya_evential['map_zoom'];
$gct1 = $tlazya_evential['map_marker_title'];
$gct2 = $tlazya_evential['map_marker_content'];
if ((isset($tlazya_evential['map_lat']) && $tlazya_evential['map_lat'] != '') && (isset($tlazya_evential['map_lng']) && $tlazya_evential['map_lng'] != '')) {
?>
<?php echo do_shortcode('[rms-googlemap lat="' . esc_attr($glat) . '" lng="' . esc_attr($glng) . '" zoom="' . esc_attr($gzoom) . '" contents="' . esc_html($gct1) . '" contents2="' . esc_html($gct2) . '"]'); ?>
<?php
} else {
?>
<?php echo do_shortcode('[rms-googlemap lat="56.171243" lng="9.556884" zoom="16" contents="ThemeonLab" contents2="Quality Template Provide"]'); ?>
<?php } ?>
<div class="container">
<div class="row">
<div class="col-md-4 col-lg-4 col-sm-6 col-xs-12">
<?php if(isset($tlazya_evential['address_info']) && $tlazya_evential['address_info'] != ''){ ?>
<div class="contact">
<?php
global $tlazya_evential;
if (isset($tlazya_evential['title_info']) && $tlazya_evential['title_info'] != '') {
echo '<h2 class="uppercase">' . esc_html($tlazya_evential['title_info']) . '</h2>';
}
?>
<?php
Related
This my code. I have used: echo "<img src="" . (++$count % 2 ? $image : 'right') . "">"; to check if my image would show or it would just right in the src section, as a test but my image shows outside of the src code. I am not sure what to do now.
<main>
<?php
global $post;
$args = array(
'post_type' => 'stg_start'
);
$latest_posts = get_posts($args);
$description = the_field('start-description');
$count = 0;
?>
<div class="container">
<div class="row">
<div class="col-lg-6">
<?php
$image = the_field('start-image');
foreach ($latest_posts as $post) :
echo "<img src=\"" . (++$count % 2 ? $image : 'right') . "\">";
endforeach;
?>
</div>
<div class="col-lg-6">
<?php
foreach ($latest_posts as $post) :
echo "<h1>" . the_field('start-title') . "</h1>";
echo "<p>by " . " | " . the_field('start-date') . "</p>";
endforeach;
?>
</div>
</div>
</div>
</main>
</div>
I want to add CCS style which depends on php IF statement. I have found something: changing the style inside "if" statement, but somehow it doesn`t work, maybe because of WHILE statement in my code.
<?php
$possible_lang_list = mysqli_query($con,
'SELECT * FROM page WHERE title = "lang" ORDER BY name1 ASC');
while ($row = mysqli_fetch_array($possible_lang_list)) {
echo '
<div class="language" id="' . $row['name2'] . '">
<p>' . $row['name1'] . '</p>
</div>
';
}
?>
I want to display only div class="language" where $row['name2'] == $x, with possibility to display whole class "language" with JavaScript. Could anyone help?
I have tried:
while ($row = mysqli_fetch_array($possible_lang_list)) {
if ($row['name2'] == $x) {
?>
<div style="display:block;">
<?php } else {
?>
<div style="display:none;">
<?php
echo '
<div class="" id="' . $row['name2'] . '">
<p>' . $row['name1'] . '</p>
</div>
</div>';
}
}
now it is working:
while ($row = mysqli_fetch_array($possible_lang_list)) {
if ($row['name2'] == $x) {
?>
<div style="display:block;">
<?php } else {
?>
<div style="display:none;">
<?php }
echo '
<div class="" id="' . $row['name2'] . '">
<p>' . $row['name1'] . '</p>
</div>
</div>';
}
Try this code :
while ($row = mysqli_fetch_array($possible_lang_list))
{
if($row['name2'] == $x)
{
echo '<div class="language" id="' . $row['name2'] . '"><p>' . $row['name1'] . '</p>
</div>';
}
else
{
echo '<div class="" id="' . $row['name2'] . '"><p>' . $row['name1'] . '</p>
</div>';
}
}
Hope it will work
Assign a style element with a true/false ternary, like below. Then just output it!
<?php
while ($row = mysqli_fetch_array($possible_lang_list)) {
$class = ($row['name2'] == $x) ? 'language' : null;
echo '
<div class="'.$class.'" id="' . $row['name2'] . '">
<p>' . $row['name1'] . '</p>
</div>
';
}
And then:
i'm getting the following error.
i cant figure it out what is wrong with this code.
there is something that i missed or forget.
can anybody please help me? i'm stuck at the moment.
he keeps saying there something with the array.
Notice: Undefined property: Cms::$contant_types in C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php on line 34
Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php on line 34
<?php
/*
CMS Class
Handle CMS task, allowing admins to view/edit content
*/
class Cms
{
private $content_types = array('wysiwyg', 'textarea', 'oneline');
private $FP;
function __construct()
{
global $FP;
$this->FP = &$FP;
}
function clean_block_id($id)
{
$id = str_replace(' ', '_', $id);
$id = str_replace('-', '_', $id);
$id = preg_replace("/[^a-zA-Z0-9_]/", '',$id);
return strtolower($id);
}
function display_block($id, $type = 'wysiwyg')
{
// clean id
$id = $this->clean_block_id($id);
// check for valid type
$type = strtolower(htmlentities($type, ENT_QUOTES));
if (in_array($type, $this->contant_types) == FALSE)
{
echo "<script>alert('Please enter a valid block type for \'" . $id . "\'');</script>";
return;
}
// get content
$content = "content here...";
// check login status
if ($this->FP->Auth-checkLoginStatus())
{
if($type == 'wysiwyg') { $type2 = 'WYSIWYG';}
if($type == 'textarea') { $type2 = 'Textarea';}
if($type == 'oneline') { $type2 = 'One Line';}
$edit_start = '<div class=""fp_edit>';
$edit_type = '<a class="fp_edit_type" href="' . SITE_PATH .'app/cms/edit.php?id' . $id . '&type='. $type . '">' . $type2 . '</a>';
$edit_link = '<a class="fp_edit_link" href="' . SITE_PATH .'app/cms/edit.php?id' . $id . '&type='. $type . '">Bewerken</a>';
$edit_end = '</div>';
echo $edit_start . $edit_type;
echo $edit_link . $content . $edit_end;
}
else
{
echo $content;
}
}
}
and the index file is
<?php include ("app/init.php");?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PassieCMS</title>
<link href="resources/css/style.css" rel="stylesheet" type="text/css">
<?php $FP->head(); ?>
</head>
<body class="home <?php $FP->body_class(); ?>">
<?php $FP->toolbar(); ?>
<div id="wrapper">
<h1>Website</h1>
<div id="banner">
<img src="resources/images/banner.jpg" alt="banner" width="900" height="140">
</div>
<ul id="nav">
<li>Home</li>
<li>Test link</li>
<li>Longer Text Link</li>
<li>Contact us</li>
</ul>
<div id="content">
<div class="left">
<h2><?php $FP->Cms->display_block('content-header','oneline'); ?></h2>
<?php $FP->Cms->display_block('content-maincontent'); ?>
</div>
<div class="right">
<?php $FP->Cms->display_block('content-quote'); ?>
<?php $FP->Cms->display_block('content-attribution'); ?>
</div>
</div>
<div id="footer">
Copyright 2014 PassieCMS | <?php $FP->login_link();?> Login optie 2
</div>
</div>
</body>
</html>
Thank you all for your time
if (in_array($type, $this->contant_types) == FALSE)
You have a typo, you have declared it as content_types above. This should work:
if (in_array($type, $this->content_types) == FALSE)
Im working with a Wordpress theme.
The code I am having trouble with is relevant to a filter divided into "action" and "categories".
I would like to have 2 checkboxes checked by default (1 action & 1 category) and the rest blank.
I'm at a complete loss, any help would be sincerely appreciated.
here is the code:
<?php
$icons = array();
$taxonomy = 'property_action_category';
$tax_terms = get_terms($taxonomy);
$taxonomy_cat = 'property_category';
$categories = get_terms($taxonomy_cat);
// add only actions
foreach ($tax_terms as $tax_term) {
$icon_name = 'wp_estate_icon'.$tax_term->slug;
$icons[$tax_term->slug] = esc_html( get_option($icon_name) );
}
// add only categories
foreach ($categories as $categ) {
$icon_name = 'wp_estate_icon'.$categ->slug;
$icons[$categ->slug] = esc_html( get_option($icon_name) );
}
?>
<div class="gmap_wrapper <?php
if (!is_front_page()) {
print 'gmap_not_home" style="height:295px;"';
}else{
print'"';
}
?>>
<div class="gmap-next <?php if (is_front_page()) print 'is-front'; ?>" id="gmap-next" > </div>
<div class="gmap-prev <?php if (is_front_page()) print 'is-front'; ?>" id="gmap-prev" > </div>
<?php
$geo_status = esc_html ( get_option('wp_estate_geolocation','') );
$custom_image = esc_html( esc_html(get_post_meta($post->ID, 'page_custom_image', true)) );
$rev_slider = esc_html( esc_html(get_post_meta($post->ID, 'rev_slider', true)) );
if($geo_status=='yes' && $custom_image=='' && $rev_slider==''){
print' <div id="mobile-geolocation-button"></div>';
}
?>
<div id="googleMap" <?php
$home_small_map_status= esc_html ( get_option('wp_estate_home_small_map','') );
if (!is_front_page() || ( is_front_page() && $home_small_map_status=='yes' ) ) {
print 'style="height:295px;"';
}
?>
</div>
<div class="tooltip"> <?php _e('click to enable zoom','wpestate');?></div>
<div id="gmap-loading"><?php _e('Loading Maps','wpestate');?>
<span class="gmap-animation">
<img src="<?php print get_template_directory_uri();
?>
</span>
</div>
<?php
////////////////////////// enable /disable map filters
$show_filter_map_status = esc_html ( get_option('wp_estate_show_filter_map','') );
$home_small_map_status = esc_html ( get_option('wp_estate_home_small_map','') );
if($show_filter_map_status!='no'){
?>
<div class="gmap-menu-wrapper" >
<div class="gmap-menu" id="gmap-menu" <?php if (!is_front_page() || (is_front_page() && $home_small_map_status=='yes') ) print 'style="display:none;"'; ?> >
<div id="closefilters"></div>
<div class="action_filter" >
<?php
foreach ($tax_terms as $tax_term) {
print '<div class="checker"><input type="checkbox" checked="checked" name="filter_action[]" id="'.$tax_term->slug.'" class="'.$tax_term- >slug.'" value="'.$tax_term->name.'"/><label for="'.$tax_term->slug.'"><span></span>';
if( $icons[$tax_term->slug]!='' ){
print '<img src="'.$icons[$tax_term->slug].'" alt="'.$tax_term->name.'">' . $tax_term->name . '</label></div>';
}else{
print '<img src="'.get_template_directory_uri().'/css/css- images/'.$tax_term->slug.'icon.png" alt="'.$tax_term->name.'">' . $tax_term->name . '</label></div>';
}
}
?>
</div>
<div class="type-filters">
<?php
foreach ($categories as $categ) {
print '<div class="checker"><input type="checkbox" checked="checked" name="filter_type[]" id="'.$categ->slug.'" class="' . $categ->slug . '" value="' . $categ->name . '"/><label for="' . $categ->slug. '"><span></span>';
if( $icons[$categ->slug]!='' ){
print' <img src="'.$icons[$categ->slug].'" alt="'.$categ->slug.'">' . $categ->name . '</label></div>';
}else{
print' <img src="'.get_template_directory_uri().'/css/css-images/'.$categ->slug.'icon.png" alt="'.$categ->name.'">' . $categ->name . '</label></div>';
}
}
?>
</div>
</div>
</div>
<?php
}
?>
</div> `enter code here`
Thanks
Kyle
I have the following XML file:
<?xml version="1.0" ?>
<Videos>
<video>
<Title>Video Title</Title>
<SubHeading>SubTitle</SubHeading>
<url>UIIArHNaKtE</url>
<image>image.png</image>
<category>3</category>
<latest>0</latest>
</video>
<video>
<Title>Video Title</Title>
<SubHeading>SubTitle</SubHeading>
<url>UIIArHNaKtE</url>
<image>image.png</image>
<category>3</category>
<latest>0</latest>
</video>
<video>
<Title>Video Title</Title>
<SubHeading>SubTitle</SubHeading>
<url>UIIArHNaKtE</url>
<image>image.png</image>
<category>3</category>
<latest>0</latest>
</video>
</Videos>
With a model file:
<?php
class xmlmodel extends CI_Model{
public function catalog(){
$doc = new DOMDocument();
$path = '../application/libraries/VideoData.xml';
$doc->load($path);//xml file loading here
$data = $doc->getElementsByTagName('video');
return $data;
}
}
The Controller:
<?php
class SixD extends CI_Controller {
public function index($sixD = 'latestadditions') {
if (!file_exists('../application/views/page/' . $sixD . '.php')) {
// Whoops, we don't have a page for that!
show_404();
}
$this->load->model('xmlmodel');
$data['category_catalog_entity'] = $this->xmlmodel->catalog();
$this->lang->load('common/menu.php');
$this->lang->load('common/headings.php');
$this->lang->load('common/links.php');
$this->lang->load('common/footer.php');
$this->lang->load('page/' . $sixD . '.php');
$this->load->view('templates/common/header');
$this->load->view('page/' . $sixD, $data);
$this->load->view('templates/common/footer');
}
}
And view:
<div class="container">
<h1 class="pageheading">
<?php echo lang('heading_pageheading'); ?>
</h1>
<hr class="heading" />
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-8 col-lg-9">
<?php foreach($category_catalog_entity as $result){ ?>
<div class="row videopane software">
<div class="col-sm-7 col-sm-push-5">
<h3 class="pageheading"><?php echo anchor('http://youtu.be/' . $result->getElementsByTagName('url')->item(0)->nodeValue, $result->getElementsByTagName('Title')->item(0)->nodeValue . '<br /><small>' . $result->getElementsByTagName( "SubHeading" )->item(0)->nodeValue . '</small>', array('class' => 'fancybox-media'));?></h3>
</div>
<div class="col-sm-5 col-sm-pull-7 text-center">
<?php echo anchor('http://youtu.be/' . $result->getElementsByTagName('url')->item(0)->nodeValue . '?autoplay=1', img("Thumbnails/" . $result->getElementsByTagName('image')->item(0)->nodeValue, $result->getElementsByTagName('Title')->item(0)->nodeValue, $result->getElementsByTagName('Title')->item(0)->nodeValue, "img-responsive img-thumbnail"), array('class' => 'fancybox-media')); ?>
</div>
</div>
<?php }
} ?>
</div>
<div class="col-sm-4 col-lg-3 software">
<?php $this->load->view('modules/menu'); ?>
</div>
</div>
</div>
</div>
</div>
This all works however I wish to define what video displays on which page so I have 2 tags:
<category>3</category>
<latest>1</latest>
and what I want to do is have all videos that have a category of 3 to display on that one page and ignore any other category number. The latest tag is used for new videos so this will either be 1 for active or 0 for do not display.
I should point out each page has a seperate view page but basically uses the same format. There is no database hence I am using XML to control this if anyone can give me some pointers would be very useful.
i do not know how you handle the whole case with the views/models. but with the actual architecture you wont get the wished result.
i made now a quick&dirty version how i would implement this.
public function catalog($category_id = 1)
{
$data = array();
//$path = '../application/libraries/VideoData.xml';
$path = '1.xml';
$xml = simplexml_load_file($path);
$json = json_encode($xml);
$array = json_decode($json, TRUE);
foreach ($array['video'] as $video)
{
if ($video['category'] == $category_id)
{
$data[] = $video;
}
}
return $data;
}
of course you could leave your original calatog method and use a new method to only get the wanted videos.
in this way you can call in your controller by an url-parameter the category and only return the filtered result to your view
*edit: as i said this is only quick&dirty... if you want keep your domdocument way :) its just for the idea
Ok solved this ended up dropping the model file and putting attributes on the xml file:
<Videos>
<video type="Module">
<Title>TITLE</Title>
<SubHeading>SUBHEADING</SubHeading>
<url>YOUTUBECODE</url>
<image>IMAGE.png</image>
<description>DESCRIPTIOM</description>
<link><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link>
<link2><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link2>
</video>
<video type="Module" id="1">
<Title>TITLE</Title>
<SubHeading>SUBHEADING</SubHeading>
<url>YOUTUBECODE</url>
<image>IMAGE.png</image>
<description>DESCRIPTIOM</description>
<link><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link>
<link2><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link2>
</video>
<video type="Common" id="1">
<Title>TITLE</Title>
<SubHeading>SUBHEADING</SubHeading>
<url>YOUTUBECODE</url>
<image>IMAGE.png</image>
<description>DESCRIPTIOM</description>
<link><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link>
<link2><![CDATA[<i class='fa-li fa fa-angle-double-right'></i>LINK]]></link2>
</video>
</Videos>
This allowed me to display individual 'videos' on the pages I wanted. Using:
<div class="col-sm-8 col-lg-9">
<?php if(file_exists('../application/libraries/VideoData.xml')) {
$xml = simplexml_load_file('../application/libraries/VideoData.xml');
$count = 0;
$counts = 0;
foreach($xml->children() as $child) {
$role = $child->attributes(); {
if($role["1"])
echo('<div class="media thumbnail software"><div class="' . (++$counts%2 ? "col-sm-5 text-center" : "col-sm-5 col-sm-push-7 text-center") . '">' . anchor('http://youtu.be/' . $child->url . '?autoplay=1', img("Thumbnails/" . $child->image, $child->Title, $child->Title, "media-object img-responsive img-thumbnail"), array('class' => 'fancybox-media')) . '</div><div class="media-body ' . (++$count%2 ? "col-sm-7" : "col-sm-7 col-sm-pull-5") . '"><h3 class="media-heading pageheading">'.anchor('http://youtu.be/' . $child->url . '?autoplay=1', $child->Title . '<br /><small>' . $child->SubHeading . '</small>', array('class' => 'fancybox-media')) . '</h3><hr class="heading"><p>'. $child->description .'</p><ul class="fa-ul"><li>' . $child->link .'</li></ul></div></div>');
}
}
} ?>
</div>
Or:
<div class="col-sm-8 col-lg-9">
<?php if(file_exists('../application/libraries/VideoData.xml')) {
$xml = simplexml_load_file('../application/libraries/VideoData.xml');
$count = 0;
$counts = 0;
foreach($xml->children() as $child) {
$role = $child->attributes(); {
if($role == "Module")
echo('<div class="media thumbnail software"><div class="' . (++$counts%2 ? "col-sm-5 text-center" : "col-sm-5 col-sm-push-7 text-center") . '">' . anchor('http://youtu.be/' . $child->url . '?autoplay=1', img("Thumbnails/" . $child->image, $child->Title, $child->Title, "media-object img-responsive img-thumbnail"), array('class' => 'fancybox-media')) . '</div><div class="media-body ' . (++$count%2 ? "col-sm-7" : "col-sm-7 col-sm-pull-5") . '"><h3 class="media-heading pageheading">'.anchor('http://youtu.be/' . $child->url . '?autoplay=1', $child->Title . '<br /><small>' . $child->SubHeading . '</small>', array('class' => 'fancybox-media')) . '</h3><hr class="heading"><p>'. $child->description .'</p><ul class="fa-ul"><li>' . $child->link2 .'</li></ul></div></div>');
}
}
} ?>
</div>
Depending what i wanted to display. Thanks for KURN's help as it made me look at different ways of acheiving this and ended up using:
http://us3.php.net/manual/en/simplexmlelement.attributes.php#113164
to assist me. Hope this helps anyone else :)