adamddickinson Posted March 19, 2007 Share Posted March 19, 2007 Hello. I get my sites content from other feeds and this displays in a layer and is a php script think. Is it possible to insert some html or something into the document to remove any links at all? Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/ Share on other sites More sharing options...
wildteen88 Posted March 19, 2007 Share Posted March 19, 2007 You can use PHP to remove html from strings. PHP has a few methods to do this. It depends on how you get the data. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210695 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 Can you provide an example of the data being retrieved and the end result you want? Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210698 Share on other sites More sharing options...
adamddickinson Posted March 19, 2007 Author Share Posted March 19, 2007 i am getting an rss feed.. generated by http://www.rssfeedreader.com I got the link set up and put the php code in the layer and turned the page into .php and it works good. just like to disable any links in the layer so users of my site cannot click on the links to get out of my site. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210712 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 Can you copy and paste an example feed. It sounds like some simple parsing needs to be done. If I had something to work with I would be more than happy to give it a shot. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210721 Share on other sites More sharing options...
adamddickinson Posted March 19, 2007 Author Share Posted March 19, 2007 Greetings <?php $olderror_reporting =error_reporting(0); include ("http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1"); error_reporting($olderror_reporting); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210731 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 <?php $rssFeed = file_get_contents($URL); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { if ($i != 0) { list($data) = split("</a>", $link); list(,$title) = split('">', $data); $link = '<a ' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210743 Share on other sites More sharing options...
adamddickinson Posted March 19, 2007 Author Share Posted March 19, 2007 so what do i do with this.. just insert it next to the php code in the layer? Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210750 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1"; $rssFeed = file_get_contents($URL); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { if ($i != 0) { list($data) = split("</a>", $link); list(,$title) = split('">', $data); $link = '<a ' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> As a side note $HTTP_* has been depreciated. See http://us2.php.net/manual/en/reserved.variables.php Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210753 Share on other sites More sharing options...
adamddickinson Posted March 19, 2007 Author Share Posted March 19, 2007 Well if i insert the code just after the rss one and save the file the links are still active www.technicalchat.co.uk/test/index2.php Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210769 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1"; $rssFeed = file_get_contents($URL); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { //debug($link); if ($i != 0) { list($link) = split("</a>", $link); list(,$title) = split('" >', $link); $title = '"' . $title; $link = '"<a' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> Sorry some minor issues, that should work. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-210795 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 greetings when putting in the code above into a layer and save the file. I get this http://www.technicalchat.co.uk/Test/index6.php Thankyou so far Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211534 Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 Try this: <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1"; ob_start(); include($URL); $rssFeed = ob_get_contents(); ob_end_clean(); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { //debug($link); if ($i != 0) { list($link) = split("</a>", $link); list(,$title) = split('" >', $link); $title = '"' . $title; $link = '"<a' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211541 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 Well the feeds show finally but they are still clickable links. Thanks www.technicalchat.co.uk/index6.php Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211544 Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 Sorry about that, I was parsing the feed in the earlier one, this one should work <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1"; ob_start(); include($URL); $rssFeed = ob_get_contents(); ob_end_clean(); $rssSplit = split('<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { //debug($link); if ($i != 0) { list($link) = split("</a>", $link); list(,$title) = split('" >', $link); $link = '<a' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211547 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 Thanks alot works a treat www.technicalchat.co.uk anychance i could take out the bottom 'Clickbank Data Feeds' The only reason i am using it is because i dont have the knowledge to try putting a rss reader on my site for my self so i am using this. It will have to do though. Also. Is it as easy as changing the link to the rss feed for another one and it will do the same with the links? I would think so... Thanks alot. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211553 Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 It would as long as they are in the same format. The feed I did it for I had to split a link using " > with the space in between, it could be just > but the issues arises that if a title has > in it, it will not work right. I get 403 forbidden trying to view that page, if I could see I am sure removing that clickbank isn't too hard. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211563 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 sorry about that.. links all over the place with this http://www.technicalchat.co.uk/Test/index6.php thanks for the above information Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211572 Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 I do not see any links on that page??? Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211577 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 Greetings: At the bottom of the page is the words.. Right at the end of the articles. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211582 Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 Just those 3 words? Pretty easy to do: <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&phpout=1"; ob_start(); include($URL); $rssFeed = ob_get_contents(); ob_end_clean(); $rssSplit = split('<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { //debug($link); if ($i != 0) { list($link) = split("</a>", $link); list(,$title) = split('" >', $link); $link = '<a' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } $rssSplit = array(); $rssSplit = split('<span style="width:100%;border:1px;border-color:#000000">', $rssFeed); $i=0; foreach ($rssSplit as $line) { if ($i != 0) { list($text) = split('</span>', $line); $replace = '<span style="width:100%;border:1px;border-color:#000000">' . $text . '</span>'; $rssFeed = str_replace($replace, "", $rssFeed); }else { $i++; } } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211588 Share on other sites More sharing options...
adamddickinson Posted March 20, 2007 Author Share Posted March 20, 2007 thankyou so much! you will be one my page of thanks once the site is built. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-211627 Share on other sites More sharing options...
adamddickinson Posted April 8, 2007 Author Share Posted April 8, 2007 Hello Everything works fine thankyou. Is there anyway i can over ride the background and font colour in there? I want the background colour #3062ba and text #FFD7A6 Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-224528 Share on other sites More sharing options...
adamddickinson Posted April 30, 2007 Author Share Posted April 30, 2007 Hi this is great. but when changing the url to another feed for another page.. Such as the yahoo feed i get the yahoo logo on the middle of my page. How can this be removed? <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.news.yahoo.com%2Frss%2Ftech&newpage=1&chead=&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=781&max=10&tlen=0&rnd=&bt=1&bs=None&nmb=1&ntb=1&naf=1&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%23FFD7A6&bg=%233062ba&bc=%233062ba&spc=&ims=1&tc=%23FFD7A6&ts=16&tfont=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1"; ob_start(); include($URL); $rssFeed = ob_get_contents(); ob_end_clean(); $rssSplit = split('<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { //debug($link); if ($i != 0) { list($link) = split("</a>", $link); list(,$title) = split('" >', $link); $link = '<a' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } $rssSplit = array(); $rssSplit = split('<span style="width:100%;border:1px;border-color:#000000">', $rssFeed); $i=0; foreach ($rssSplit as $line) { if ($i != 0) { list($text) = split('</span>', $line); $replace = '<span style="width:100%;border:1px;border-color:#000000">' . $text . '</span>'; $rssFeed = str_replace($replace, "", $rssFeed); }else { $i++; } } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43381-how-to-remove-links-from-a-layer-containing-php/#findComment-241912 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.