We have info being inputted on the subdomain (www.agent.xxxx.com) and posting results from the editor on the main site (www.xxxx.com) everything from the editor is displayed correct except for external video links. Using the code here the results for video links are adding the subdomain agent/ in front of the link causing the error and resulting in agent/www.youtube.com/xxxxxx
We just need to correct this only on external links
<?php
$this->result->aboutme = str_replace('src="', c="agents/', $this->result->aboutme);
echo $this->result->aboutme;
?>
Related
I want to use page url eg. example.com/randomimage/ in HTML <img> tag to display random images.
Is that possible with PHP?
I can change /randomimage/ page code via page-randomimage.php file.
You can't return an HTML page from your PHP script for that to work. In HTML, <img> tags are designed to load image content, not HTML content.
Instead you could program page-randomimpage.php to redirect to a random image URL. Something like this random redirect script but with image URLs in it rather than website URLs. The redirects should be "302 Temporary" type redirects so that the redirector result is not cached by browsers.
I recently started a new position as a graphic designer for a local nonprofit. I have a little background in HMTL and CSS, but their website runs on PHP and I'm already struggling to work with the code.
I need to add an inline frame to embed a webpage within a specific page on our website. The programmers who built our site didn’t build a user friendly interface where we can embed HTML, so I'm told that I need to add the iframe snippet into the PHP for that page. However, the page I want to edit does not have it's own PHP file. It is a subpage under one of the site's main nav categories. I was able to find a PHP file which corresponds to that main nav category that this subpage falls under. I believe that this is where I would need to add the code. It appears to be a template which structures all of the pages inside of this broader nav category.
Can anyone help me with this? I'm not sure if you can just add HTML to a PHP file as is, or if it needs to be altered a bit. Also I need to know how I could have the PHP template selectively load the desired iframe only on the page that actually needs it - I don't want that iframe to appear in all the other pages that fall within the broader nav category.
The code I need to embed looks like this:
<iframe width="100%" height="800px" src="https://google.com" frameborder="0" scrolling="yes"></iframe>
you can use html as it is on php page.
point 2: you want to show iframe on specific page only...
e.g. on page xyz.php
<?php
$basename = basename($_SERVER['PHP_SELF']); /* Returns The Current PHP File Name */
if ($basename == 'xyz.php'){ ?>
<iframe width="100%" height="800px" src="https://google.com" frameborder="0" scrolling="yes"></iframe>
<?php } ?>
For some reason, on my server, images do not display if they're remotely (or locally) embedded in an HTML page, but they do work when visited directly.
Embed code:
<img src="http://c.beastsmc.com/banners/creative.png"/>
Here's a fiddle showing the image not displaying: http://jsfiddle.net/gKHM7/
Here's the direct image, which works: http://c.beastsmc.com/banners/creative.png
The .htaccess file is empty.
Any ideas?
As jcansyi mentioned above (upvote him!), the problem was that AdBlocker blocked the image. The reason it was blocking it was the name of the folder (banners). AdBlockPlus blocks any URL with /banners/ in it.
I have a table in database which stores links submitted by users, I want my users to use those links whenever they want but the problem i am facing is
I can retrive and display the links with this code
<td width="560"><font color="#999">
'.$row['link'].'
</font>
</td>
but it generates link like this
http://XYZ.com/www.pxleyes.com/blog/2011/12/these-50-photos-will-blow-you-away/?action=tagtoload
so when the users click on this links it says page not found.
I want to open the links within my page so i have added ?action=tagtoload
which will load pages within my page with ajax call but the things are not working.
yes XYZ.com is my domain and for not generated links xyz.com/abc?action=tagtoload is working fine. its coming just below top header i want all external links to be below my header. can you please tell how i can open these links under my header. I want to display these links as anchored link so that user can see what these items are and when users clicks on these links it should open in iframe or whatever but under my header –
Guessing that XYZ.com stands for your domain:
add http:// for external links
Concerning the ajax-Problem:
Is it working with fixed, not generated links? Please post also the output of the php file and your ajax-code.
Please also define 'in you page': In an iframe? div? replacing your window?
EDIT:
To 'fix' you 'php-code':
<td width="560">
<font color="#999">
<a href="<?php print $row['link'] ?>?action=tagtoload" class="tagToload">
<?php print $row['link'] ?></a>
</font>
</td>
Please get familiar with html and php first.
do NOT use <font>, use css instead
use css instead of putting the width in the td as an attribute
read http://php.net/
Right now I have a variable: $blogbody which contains the entire contents of a blog.
I'm using the following to convert URLS to clickable links:
$blogbody = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","\\0", $blogbody);
And the following to resize embedded video:
$blogbody = preg_replace('/(width)=("[^"]*")/i', 'width="495"', $blogbody);
The problem I'm running into is the embedded video not working, comes back with an Access Forbidden error (403). If I remove the line to convert URLS to links, the embedded video works fine. Not sure how to get these two working together. If anyone else has a better solution to converting URLS to clickable links and resizing embedded video let me know!
This might be happening because the link which you use to embed the video also gets his <a href=''> tags added. So instead of just converting all links, check that they don't have ' or " directly behind or in front of them - this will make sure that the embedded videos' links won't get anchor tags.