need to understand a css/php sentence [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Can someone please break this line down for me.
<div class="container" class="<?php wpp_css('property::content', "property_content"); ?>" role="main">
Many thanks.

Explanation:
<div
It's a div element
class="container"
with the CSS class container.
class="<?php wpp_css('property::content', "property_content"); ?>"
This is wrong! An element can have only one class attribute!
But it seems that you try to add custom CSS classes with the PHP function wpp_css.
role="main">
Your div has the attribute role with value main. More info about roles here.
Corrected div:
<div class="container <?php wpp_css('property::content', "property_content"); ?>" role="main">

wpp_css is a function, first parameter is 'property::content' second parameter is "property_content"
i think it is used to pass the right content to the container

You create a div with a dynamic class. The class is being generated ny a PHP function called wpp_css and the div's role is main

I am guessing your using "WordPress Popular Posts" plugin and the method wpp_css() is a method of this plugin to determining which CSS class should be applied to your container div.
It first checks that whether any value is set for the 'property::content' property or not. If it is set then it returns that otherwise it returns 'property_content'.
You also have two class attributes in your div. You should change them like this.
<div class="container <?php wpp_css('property::content', "property_content"); ?>" role="main">

Related

how to call a PHP class function in another page by a link [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
i have a menu that has an option to retrieve data from the database and show it to the user, i set up a link on an icon, when the user clicks on the icon, i want it to redirect to the php class page and call a function from it, i don't need to pass any parameter to it, i just want to call the function, how can i do this?
the menu
<div class="side-menu">
<ul class="menu">
<li class="menu-item">
<a href="" class="link"> <img class ="optionn" src="option.png" alt="option">
<span class="link-text">see menu</span>
</a>
</li>
</ul>
</div>
the php class page
class userRides
{
function showMenu()
{
//retrieve data and show it
}
//other functions
}
A PHP class isn't a "page", and doesn't correspond to a particular URL which you can request directly from the browser. To execute the method, you write some PHP code which includes the file which defines it, and then uses it, e.g.
require_once __DIR__ . '/../classes/userRides.php';
$rides = new userRides;
$rides->showMenu();
(Or you can configure an autoloader which automatically triggers the file include when you use the class.)
You then place that code in a file and point your web server at that. For instance, your web server might point at the directory "/home/h.nasserel/website/public", the three lines above in "/home/h.nasserel/website/public/menu.php", and the class in "/home/h.nasserel/website/classes/userRides.php". You would then access "http://something.example.com/menu.php" in your browser, and it would run the PHP code.

Working with Iframes and PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have several questions about php content in Iframe.
I want to create some navigation links and target the Iframe. Is there an easy way to do?
Do you think I can only do this with Ajax or Ahah ?
This is what I ve tried so far, but it does not work.
Here is my code.
// HERE ARE NAVIGATION LINKS
<header>
<h1>Välkommen till Min Sida</h1><br>
<nav>
HOME
ABOUT ME
CONTACT
SUBSCRIBE
</nav>
</header>
// HERE IS MY IFRAME WHERE I WANT TO OPEN MY PHP FILES
<div class='content' >
<iframe>
<?php
$go = #$_GET["go"];
switch($go){
// IF I CLICK ON "WELCOME" FROM THE NAVIGATION BAR, OPEN THIS LINK IN My IFRAME
case "welcome";
include("welcome.php");
break;
// IF I CLICK ON "ABOUT" FROM THE NAVIGATION BAR, THIS LINK IN MY IFRAME
case "about";
include("newarrivals.php");
break;
// AS "DEFAULT", SHOW THIS IN THE IFRAME
default;
echo
<figure>
<img src="figure.png" alt="Figure 1" style="max-width:80%; height:auto;">
<figcaption> <h6> Illustration: Mehmet Akb. </h6> </figcaption>
</figure>
break;
}
?>
</iframe>
</div>
</div>
</body>
You can use javascript to reload iframe
Move your iframe content to icontent.php
Add some ID into iframe <iframe id="contentFrame"></iframe>
Change your link action
HOME
ABOUT ME
CONTACT
SUBSCRIBE
Create this javascript function
function goto(url) {
document.getElementById("contentFrame").contentWindow.location.replace(url);
}
If your Iframe has a name, you can use target property to determine the iframe name such as
<iframe name="topframe"></iframe>
<a href="xxx" target="topframe">

PHP Using a variable from an include [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I got a simple PHP code like this one:
<div id="master">
<div id="info">
<?php include 'division.php';
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php include 'lastmatches.php';?>
</div>
</div>
</body>
As you see i want to echo $winrate, but $winrate is a variable that comes from lastmatches.php. So it will never work. Some has got an idea to echo $winrate in the div info? Im stuck and i hope you guys can help me out!
Thanks in advance!
You need to include lastmatches.php before to define $winrate.
But if this file outputs some content then you will want to use the caching system to output the right content at the right place.
<div id="master">
<div id="info">
<?php include 'division.php';
// begin cache
ob_start();
include 'lastmatches.php';
// end cache
$lastmatchescontent = ob_get_clean();
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php echo $lastmatchescontent; ?>
</div>
</div>
</body>
i suggest you to follow MVC approach, if you do not want to use framework u can do something like this: https://github.com/LPodolski/basic_php_templating
this will allow code to be more readable, by separating concerns of generating output from getting data from db, parsing it etc

Strange variables. XSL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've such piece of code:
<xsl:template match="bottom">
<div class="l1">
<div class="l2">
<div class="fl100">
<div align="center">
<div class="mw" align="center">
<div class="footer">
<div class="f1">$-BOTTOM_COPY-$</div>
<div class="f2">
$-BOTTOM_CONTACTS-$
</div>
<div class="f3">
$-BOTTOM_LINKS-$
</div>
<div class="f4">
$-BOTTOM_STUDY-$
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I cannot understan where from $-BOTTOM_CONTACTS-$, $-BOTTOM_LINKS-$ etc variables are.
I'm new in xsl, and searched every src files, but didn't find any declaration of define in php code.
Any idea?
It looks to me as if someone has included these bits of text (like $-BOTTOM_STUDY-$) as a target for replacement with something specific. Either they intended them to be replaced in the stylesheet before running the transformation, or they intended them to be replaced in the output file after running the transformation. But as far as XSLT is concerned, they are just strings to be copied from the stylesheet to the result document.

Displaying the image in other div - wordpress [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to display the image of posts in other div then content's one.
I mean like this.
<div class="latest-posts">
<div class="latest-posts-info">
<div class="title"><h1>HERE IS TITLE<h1></div>
<div class="text">HERE IS CONTENT</div>
Read more...
<div class="clear"></div>
</div>
<div class="latest-posts-img">HERE I WANT THE IMAGE</div>
<div class="clear"></div>
</div>
While was adding a post in wp admin, i noticed its the only way, displaying image IN content.
Thanks
Check out this page : http://codex.wordpress.org/Function_Reference/the_post_thumbnail
<div class="latest-posts-img"> <?php the_post_thumbnail( $size, $attr ); ?> </div>
You can try to add a custom template for this post using this function:
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

Categories