Im working on a article:
I want 3 in one row. I know how to do it with stype, but i dont know how to do it with style.php.
enter image description here
This is only the part of code but I need to properly implement grid:
echo '<div class="container">';
echo '<div class="row padding">';
echo '<div class="col-md-4 col-sm-12">';
echo '<div class="card">';
echo '<img src="' . UPLPATH . $row['slika'] . '"';
echo '<div class="card-body">';
echo '<h6 class="card-title">';
echo '«';
echo $row['naslov'];
//style.php
<?php
header('content-type:text/css');
$grid='grid';
?>
.container {
display: <?=$grid?>;
}
Well, you are dealing the problem really improperly.
I don't really get why you need to use a variable named $grid while you can directly pass the grid attribute to your .container.
You don't have do complicate it like this.
What I would do in your case would be the next thing:
I would create a class named .grid like:
.grid {
display: grid !important;
}
As for the rest I would put it like this:
Please provide more info as regards how you extract out the $row variable data.
The layout per se, would have to be like this in order for you to have 3 cards in a row. Hope that helps you. Cheers
<div class="container grid">
<div class="row padding">
<div class="col-md-12 col-sm-12">
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="card">
<img src="<?= '"'. UPLPATH . $row['slika'] . '"' alt="whatever
you need" />
<div class="card-body">
<h6 class="card-title">
<?php echo '«' . " ". $row['naslov']; ?>
</h6>
</div>
</div>
</div>
</div>
</div>
Related
Here I need to change the text to tax invoice. I don't know much of Codeigniter. Here is the code.
<!-- Invoice Company Details -->
<div id="invoice-company-details" class="row mt-2">
<div class="col-md-6 col-sm-12 text-xs-center text-md-left">
<p></p>
<img src="<?php $loc = location($invoice['loc']);
echo base_url('userfiles/company/' . $loc['logo']) ?>" class="img-responsive p-1 m-b-2" style="max-height: 120px;">
<p class="ml-2"><?= $loc['cname'] ?></p>
</div>
<div class="col-md-6 col-sm-12 text-xs-center text-md-right">
<h2><?php echo $this->lang->line('INVOICE') ?></h2>
<p class="pb-1"> <?php echo $this->config->item('prefix') . ' ' . $invoice['tid'] . '</p>
<p class="pb-1">' . $this->lang->line('Reference') . ':' . $invoice['refer'] . '</p>'; ?>
<ul class="px-0 list-unstyled">
<li><?php echo $this->lang->line('Gross Amount') ?></li>
<li class="lead text-bold-800"><?php echo amountExchange($invoice['total'], 0, $this->aauth->get_user()->loc) ?></li>
</ul>
</div>
</div>
<!--/ Invoice Company Details -->
The invoice title is set in this line:
<h2><?php echo $this->lang->line('INVOICE') ?></h2>
To change this content, go to: application/language/english and find the language files in there, and search for the string INVOICE in all language files. Change it there accordingly.
(Of course, there may be other languages specified other than English asd well - if your application is multilingual - in that case, you need to check for this string in all language folders.)
I have this problem
and that code is here
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
<div class="col-md-4 text-center animate-box">
<a href="work-single.html" class="work" style="background-image: url(images/portfolio-2.jpg);">
<div class="desc">
<h3>Project Name</h3>
<span>Brading</span>
</div>
</a>
</div>
now i tried to do a while loop for my php and did this code
<div class="row">
<?php
while ($userRow=$stmt2->fetch(PDO::FETCH_ASSOC))
{
echo "<div class='col-md-4 text-center animate-box'>";
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
echo "<div class='desc'>";
echo "<h3>Project Name</h3>";
echo "<span>Illustration</span>";
echo "</div>";
echo "</a>";
echo"</div>";
}
?>
</div>
and it got me this
So what i tried so far is this
<?php
while ($userRow=$stmt2->fetch(PDO::FETCH_ASSOC))
{
<?
<div class='col-md-4 text-center animate-box'>
<?php
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
echo "<div class='desc'>";
echo "<h3>Project Name</h3>";
echo "<span>Illustration</span>";
echo "</div>";
echo "</a>";
<?
</div>
<?php
}
?>
but still not working still the same layout . sorry for my bad english . Can someone help me to figure out what is the problem on my code. Thank you everyone in advance
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ")';";
You are missing a > at the end.
You've missed a > in your anchor tag and also misplaced the semicolon of the CSS. Replace your code with the following one.
echo "<a href='work-single.html' class='work' style='background-image:url(uploaded_files/uploaded_files_articles_images/" .$userRow['image']. ");'>";
It displays the cards in one column instead of three at medium sizes.
I've tried the basic layout in HTML and it works fine.
echo '<div class="row>';
if($res->num_rows > 0){
while($row = $res->fetch_assoc()){
echo '<div class="col s12 m4">' .
'<div class="card">' .
'<div class="card-content">' .
'<span class="card-title">' . $row["Kanji"] . '</span>' .
$row["Onyomi"]. ' ' . $row["Kunyomi"] .
'</div>' .
'<div class="card-action">' .'<p>' . $row["English"] . '</p>' . '</div>' .
'</div>'.
'</div>';
}
}
echo '</div>';
I did it back to front.
Here is what worked.
<div class="row">
<?php if($res->num_rows > 0){
while($row = $res->fetch_assoc()){
?>
<div class="col s12 m4">
<div class="card">
<div class="card-content">
<span class="card-title"><?php echo $row["Kanji"] ?></span>
<p><?php echo $row["Onyomi"]; echo $row["Kunyomi"] ?></p>
</div>
<div class="card-action">
<?php echo $row["English"] ?>
</div>
</div>
</div>
<?php } } ?>
you can check for materialize grid https://materializecss.com/grid.html
Using materialize grid you you can put the necessary columns.
One example for 3 columns in a row
<div class="row">
<div class="col s4">Column 1</div>
<div class="col s4">Column 2</div>
<div class="col s4">Column 3</div>
</div>
you forgot quotation marks at the end of row class: class="row>
Hi everyone I am trying to print out wordpress tag into html class, code looks like this
<div id="space-above" class="mix /* Print Tag Here */ col-xs-12 col-sm-6 col-md-6 col-lg-4">
To get something like this
<div id="space-above" class="mix g col-xs-12 col-sm-6 col-md-6 col-lg-4">
I tryed using get_the_tags(); but had no luck so far.
Here is whole code I have in content.php
<div id="space-above" class="mix col-xs-12 col-sm-6 col-md-6 col-lg-4">
<a class="cast-shadow" href="<?php the_permalink() ?>">
<div class="card-wraper">
<img src="#" alt=""/>
<div class="card-text">
<?php the_title( '<h2 class="card-title">', '</h2>' ); ?>
<?php the_content( '<p class="card-description"><a class="card-text-link" href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></p>' ); ?>
</div>
</div>
</a>
</div>
Any help is much appreciated.
get_the_tags returns an array, so something like this should work:
<div id="space-above" class="mix <?php foreach( get_the_tags() as $tag ) { echo $tag->name.' ';}; ?> col-xs-12 col-sm-6 col-md-6 col-lg-4">
Here's what you want. You can get the tags first, then add them using jQuery. Have a try
<div id="space-above" class="mix col-xs-12 col-sm-6 col-md-6 col-lg-4">
<a class="cast-shadow" href="<?php the_permalink() ?>">
<div class="card-wraper">
<img src="#" alt=""/>
<div class="card-text">
<?php the_title( '<h2 class="card-title">', '</h2>' ); ?>
<?php the_content( '<p class="card-description"><a class="card-text-link" href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></p>' ); ?>
<? $t = wp_get_post_tags($post->ID);
$htm = '';
foreach ($t as $tg) {
$htm .= $tg." ";
}
?>
</div>
</div>
</a>
</div>
<script type="text/javascript">
var classes = "<?php echo $htm; ?>"
jQuery('.mix').addClass(classes)
</script>
Thanks
For some reason my application is giving me a PHP error saying
Cannot use object of type stdClass as array on line 45.
A little stumped on why this is happening. Any idea?
I have been dabbling with this for over an hour now. Searched around on here as well. I'm so stumped. I hope it's not something simple that I'm just missing. Any help?
<section class="inner-pageBanner" style="width:100%; height:300px;
background: url(/uploads/home.png) no-repeat center center; background-size:cover;">
</section>
<div class="banner-text">
<h2 style="margin-top:100px; font-size:80px; color:#333;">Search
Results</h2>
</div>
<section class="homeAnimation">
<div class="featured-products products-slider">
<div class="container">
<div class="col-md-12">
<?php
$seg2 = $this->uri->segment('2');
$search = (empty($seg2) ? $_POST['search'] : $seg2);
$itemsq = $this->db->query("SELECT * from `products` where `text` like '%" . htmlspecialchars(addslashes($search)) . "%'");
$items = $itemsq->result();
foreach($items as $item){
?>
<div class="col-md-6 featured-item">
<div class="col-md-12 featured-background">
<div class="col-md-4">
<img class="featured-img" src="<?php echo $item->image; ?>"/>
</div>
<div class="col-md-8">
<div class="row">
<div class="col-md-12">
<a class="featured-title"
href="/product/<?php echo urlencode($item->code) . '/' . slugify($item->text); ?>">
<h4><?php echo $item->text; ?></h4>
</a>
<p class="trunc-desc"><?php echo $item->text; ?></p>
</div>
</div>
<div class="row " style="margin-top:0px; margin-bottom:0px;">
<div class="col-md-12">
<h4 style="margin-top:0px; font-size:18px;">As Low As:
<span
style="display: inline; color:forestgreen">$<?php echo number_format($item['price'] + ($item['price'] * ($settings->markup / 100))); ?></span>
</h4>
<br/><a
href="/product/<?php echo urlencode($item->code) . '/' . slugify($item->text); ?>"
class="featured-buy-btn">Buy Now</a>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
error in this line code
<?php echo number_format($item['price'] + ($item['price'] * ($settings->markup / 100))); ?>
....
$item['price']
change to
$item->price
alternatively you can convert your Mysql result to an associative array with this function db_result_to_array($îtems). Then you can access the values of the array with $item['key']. in the associative array the keys will be the column headers.