Jump to content

Canman2005

Members
  • Posts

    669
  • Joined

  • Last visited

    Never

Everything posted by Canman2005

  1. GingerRobot, I did try your code and it worked fine, the only problem I could see was bad formatting, so for example, it works great with <h1>Title One</h1><br>This is text one<br><br> but if an extra line break is added, such as <h1>Title One</h1><br>This is text one<br><br><br> then it breaks the code and just displays the first result. can you help at all? thanks very much everyone so far
  2. I seem to be able to use $search = '~<h1>(.*)</h1>~s';preg_match($search, $mytext, $match);echo $match[1]; but the problem is that is grabs the first and last <h1> tag, whereas I guess I need to return each <h1> tag seperately and then run the code above on each line returned. any ideas?
  3. incase formatting is a mess, is it possible to just pickup the headings based on a <h1> and </h1> tag I tried using something like $search = '~<h1>(.*)</h1>~s'; preg_match($search, $mytext, $match); echo $match[1];
  4. I don't really have anything, i've been looking on forums and trying different bits of code and altering them, but nothing I have found seems to get me on the right track. I am quite new at php but im sure its not impossible to do this will continue my search
  5. Do you have a snippet of code like that? been trying to solve this for last few hours now and no go thanks
  6. Sorry I forgot to say, the output is like this <h1>Title One</h1><br>This is text one<br><br><h1>Title Two</h1><br>This is text two<br><br><h1>Title Three</h1><br>This is text three So there are <h1> tags between the headings
  7. Hi all I have a chunk of text which looks like $mytext = "Title One<br>This is text one<br><br>Title Two<br>This is text two<br><br>Title Three<br>This is text three"; This outputs Title One This is text one Title Two This is text three Title Three This is text three Is it possible to get it to format like this <a href=?id=1>Title One</a> <a href=?id=2>Title Two</a> <a href=?id=3>Title Three</a> Thanks very much Dave
  8. The problem im finding is this If I use the following code like suggested $img = 'text start <img src="http://www.google.co.uk/intl/en_uk/images/logo.gif"/> text end'; $image = preg_replace('~.*?(<img[^>]*>).*~is','$1',$img); Then it works fine and displays the image and hides the text. But if no image is available in the string such as $img = 'text start text end'; $image = preg_replace('~.*?(<img[^>]*>).*~is','$1',$img); Then it prints the text, whereas I need to get it to not display the text, even if no image exists. Any ideas? Thanks very much
  9. Sorry Let me explain what im doing. Im displaying an RSS feed and with each RSS article is an image, so what i'm trying to do is strip out all the article text and just display its image. The problem is that some articles have an image and some dont. If I use the suggested solutions, everything works fine and images are displayed without the article text. The problem is that when it comes to an article that has not got an image, then it seems to display the text inside the ALT tag. Does that make much sense? Thanks very much so far everyone
  10. Really I just want to strip out the ALT tag that's defined on each image i;m displaying Is there a way to strip out ALT tags assigned to images?
  11. Cool cool preg_replace('~.*?(<img[^>]*>).*~is','$1',$string); seemed to work fine Is there a way to detect if an image appears in the $string and if no image exists, then it wouldnt run preg_replace('~.*?(<img[^>]*>).*~is','$1',$string); Thanks
  12. Hi all I'm doing the following ereg_replace("<img[^>]*>", "", $string); which is stipping out all images from my string. Is there a way to reverse this, so it strips out everything but the image? Thanks
  13. Hi all We have a website and a folder of Word Documents that we don't want people to be able to access directly with a link, we dont mind people accessing the folders content once a SESSION ID has been created. Is there anyway to secure a folders contents so that the only people who can access the files in the folder would be those who have had a SESSION ID created already? Maybe using the .htaccess file somehow Thanks
  14. solved it thanks for the inital comments, got me on the right track
  15. and figured out page numbering with $pages = 1; $totalpages = $rowsnum/2; for ($i = 0; $i < $totalpages; $i++) { print $pages++.' | '; }
  16. ok, I have figured out the first issue I had by doing $row = 1; foreach ($rss->items as $item) { $rowsnum = $row++; } print $rowsnum; that seemed to work fine. I guess I can figure out page numbering based on the total number returned.
  17. with your solution, is it possible just to grab the last value so that rather than 1 2 3 4 5 6 it would just display 6 as a total? thanks
  18. sorry, I mean a page numbering system, so for example, if you have 10 results in your foreach ststement you could display two of those ten per page over 5 pages if that makes sense
  19. Hi all I have a couple of questions based on foreach ($rss->items as $item) { } if you're able to help. 1: Is it possible to define a variable that will give me a total number of results in the foreach statement? 2: Is it possible to archive a page numbering system with foreach? Thanks everyone Dave
  20. I'm trying to define a SESSION ID though the URL Does anyone know why $sess = $_GET['sess']; print $_SESSION['$sess']; Does not work? Any help would be great
  21. It's ok, i've found a solution, by putting <div style="clear: both;"></div> at the end of each article HTML feed solves it
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.