Working with Iframes and PHP [closed] - php

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">

Related

Hyperlink to a <div> on another page in PHP

I have referred to the solution given in this answer but failed to make it work. I have an index.php page which says:
<a href="page.php#anchor-name">
However, this link always direct to page.php and not to #anchor-name div on that page.
Is this so because I'm trying on localhost? Whats the problem that this works on HTML but not php? Whats the solution to make this work on php?
The relevant section of the code:
<a class="metro-box blue-gradient normal" href="Services.php#Ecommerce">
<div class="metro-box-icon"><i class="icon-user"></i></div>
<div class="metro-box-title"><h5>Cloud Utilities</h5></div>
</a>
I want the hyperlink to land on this div on Services.php:
<div class="three-fourth last-in-row" id="#ECommerce">
You are dealing with named anchors.
In this, you can give link to a particular section in the page.
E.g.
Say, I have following divs.
<div id="first">Bla Bla</div>
And this div is far below header, you can give a link to it using hash.
Go to First
By clicking on the link, your respective div will get focused.

How can I replace html elements with php? [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 7 years ago.
Improve this question
I have a website in which I use just html, but I'd like to add one location where I would edit things like the nav and the footer. Then it would be instantly updated across the whole site.
So, for example, I'd like to put:
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Into
<?php echo $nav;?>
Any help would be greatly appreciated! =)
Add the html that you want to show into a file. For eg:
add this to menu.html
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Now include this page in other HTML pages wherever you want to call it like below
<?php
include 'menu.html';
?>
I like Lal's answer. I would change include 'menu.html'; with include_once 'menu.php'; The idea is that you will can add some php variables if you need them on some point.....

Basic PHP syntax for editing a Wordpress social sharing plugin [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'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.

How to linking to a div in html? [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 have a list of links and the content of links are in that page, how can I link to a place of the page?
for example:
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
How can I link to div3
Make use of the id for div3 like this:
Link to div3
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
Here you can read more about it.
Use an anchor to refer to your div ID.
Link to div3
You can find some documentation here: http://webdesign.about.com/od/beginningtutorials/a/aabg020899a.htm
link to name1
<a name="name1">Name1</a>
Is the original structure from netscape.
Both of these work today.
<ul>
<li> 1
<li> 2
</ul>
<div style="height:100%" id="name1">Name1</div>
<div style="height:100%" ><a name="name2">Name2</a></div>

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