Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
on my website when the content switches to impressum once you click on it, it doesnt apply my css style, cant seem to find the problem. HTML-code: seen with ctrl + u on website!
<?php include ("$website_pages/navbar.html");?>
<div id="content">
<?php
if ($_GET ['page'] == "impressum1") {
include ("$website_pages/impressum1.html");
} else {
include ("$website_pages/home.html");
}
?>
<div id="impressum">
Impressum
</div>
</div>
I think you have to remove the / in your link. You have relative paths that were affected by the /
http://quersteil.eu/index.php?page=impressum1
Your css is not beeing loaded. You need to change your link to:
<link href="/style.css" type="text/css" rel="stylesheet">
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Here Is the link that I have tried
<a href="<?php echo $this->config->item('base_url') . 'index.php/back-office-panel/User_master#tab4' ?>">
But its not working
suggest answers.
I want to go to edit of that particulate section which is tab format.
Simple pass the uri parameter 'index.php/back-office-panel/User_master/tab4'
<a href="<?php echo $this->config->item('base_url') . 'index.php/back-office-panel/User_master/tab4' ?>">
PHP: Check the condition and echo the active class in tab.
if(isset($this->uri->segment(3)) && $this->uri->segment(3)=='tab4'){
echo 'active';
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Using advanced custom fields plugin on my wordpress site. I have a select option in one of the custom post types which determines if post going to be a link to another page or call out popup.
Here is how it looks.
<!-- here goes a code defining post type. Works fine -->
<?php $hmltype = get_field('post_url_or_popup'); ?>
<div class="tablecell midlineunit middle">
<a class="table midunithref mw1" <?php if ($hmltype == hml_url) { echo 'href="<?php the_field('hplb_url'); ?>" ' } endif; ?> >
</a>
</div>
Must be a syntax error, but I'm just starting out with php, so, kind of difficult to find the mistake.
What is hml_url? Is it a variable called $hml_url..? Back to your issues, you're using endif; here completely wrong. You can only ever call it if you instantiate it like this:
if(condition) :
do stuff;
endif;
Now to fix your print.
<a class="table midunithref mw1" <?php echo ($hmltype == hml_url) ? 'href="'. the_field('hplb_url'); .'"' : ''; ?> >
You'll need to figure out/tell us what hml_url is for us to solve your issue. You would've also seen the error if you turned your error reporting on. You can do this by adding this to the top of your script:
ini_set('display_errors', 1);
error_reporting(-1); // or you could do E_ALL
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am building a wordpress theme and for some reason my list of pages are showing outside the li when I view the source
<ul class="tabs">
<?php
while ( $queryObject->have_posts()) : $queryObject->the_post();
echo sprintf('<li>%s</li>', the_title());
endwhile;
?>
</ul>
And when I review the source in the inspector in chrome
<ul class="tabs">
Deans’ Corner<li></li>
Education Plan<li></li>
Counselors’ Corner<li></li>
</ul>
I got to be missing something simple
Take a look at the docs for the_title():
https://codex.wordpress.org/Function_Reference/the_title
Displays or returns the title of the current post.
[...]
$echo
(Boolean) (optional) Display the title (TRUE) or return it for use in PHP (FALSE).
Default: TRUE
the_title() takes an optional parameter $echo which decides whether it should return or echo the title of the page. Since you did not fill it and it defaults to the echo option, your code does not work.
If the_title() echoes, you won't be able to use it directly with sprintf().
Therefore, you can do just use HTML...
<li><?= the_title(); ?></li>
The below example is unnecessary because of the_title()'s optional parameters as pointed out in Timosta's answer.
Or you can use output buffering if you need to use the_title() as a function argument:
ob_start()
the_title();
$title = ob_get_clean();
echo sprintf('<li>%s</li>', $title);
The problem is that by default the_title() echos the title instead of returning it. You can actually specify what to echo before and after the title so there is no need for using sprintf().
This should work:
<ul class="tabs">
<?php
while ( $queryObject->have_posts()) : $queryObject->the_post();
the_title('<li>', '</li>');
endwhile;
?>
</ul>
Check the WordPress Codex:
http://codex.wordpress.org/Function_Reference/the_title
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'm trying to edit a social sharing plugin, to change the link/text show in the popups for twitter, etc..
Basically when it clicks to share on Twitter, it displays the page title and current URL on a thank you page, I want to customize it to display certain text and a different URL. Tried changing the &url=<?php echo $url; ?> part to &url=<?php http://www.urltext.com; ?> for example but doesn't work, how can I edit this so the syntax is proper?
case 'twitter':
?><a rel="external nofollow" class="ss-twitter" href="http://twitter.com/intent/tweet/?text=<?php echo $title; ?>&url=<?php echo $url; ?><?php if(!empty($twitter_username)) { echo '&via=' . $twitter_username; } ?>" target="_blank"><span class="ss-icon-twitter"></span><?php echo $twitter_text; ?></a> <?php
break;
The syntax is incorrect. You'll want to use:
&url=<?php echo 'http://www.urltext.com'; ?>
The url is a string; so you need to echo it as a string.
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