Jump to content

gonefussin

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gonefussin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Think I got it A guy over at webdesignerforum helped me out, for anyone intersted here's the fix: <?php $url_list = array(); query_posts(''); while (have_posts()) : the_post(); $content = parse_url(strip_tags(get_the_content())); $url = $content['host']; if(!in_array($url, $url_list)) { ?> <li><a href="http://<?php echo $url; ?>"><?php echo $url; ?></a></li> <?php $url_list[] = $url; } endwhile; ?>
  2. I had a feeling it wouldn't work like that, I've been looking for ways to add it to an array and then just echo the array at the end once the loop is done but still can't figure it out. Yea, I think you're right, it's not so much duplicating them as posting two with the same content. Like I said, I've been trying to add the content to an array but I can't get it to work, Google's failing me too.. I know how to create an array with the data already defined at the beginning but can't figure out how to add stuff to an existing array. Would I then check the array with array_unique(), scoots? Cheers, Craig.
  3. Hi Scoots, Could you elaborate on that please? I've tried stopping it via have_posts with "if($post->ID == $do_not_duplicate) continue; ?>" but it either doesn't stop the duplicates coming out or outputs nothing at all. I don't know what you mean by the code that saves the data. Am I on the right track with this: <?php query_posts(''); ?> <?php while (have_posts()) : the_post(); $s = array(the_content()); $d = array_unique($s); ?> <li><a href="http://<?php $content = parse_url(strip_tags($d)); echo $content['host']; ?>"><?php $content = parse_url(strip_tags($d)); echo $content['host']; ?></a></li> <?php endwhile;?> Thanks, Craig.
  4. Hi Lite, Yea I tried, but I don't think I got the code right. It was just spitting out "Array Array Array ...". If you think that's what'll work I'll try again, if you've any tips that'd be great. Thanks, Craig.
  5. Hi. I'm new to PHP and Wordpress, quite the beginner. I thought I finally had it all done on my site and I've stumbled on another issue. Basically I post a link and it spits it out. I sometimes post links that have the same domain ($content['host']) but I don't want these to be duplicated. Here's what I have: <?php query_posts(''); ?> <?php while (have_posts()) : the_post(); ?> <li> <a href="http://<?php $content = parse_url(strip_tags(get_the_content())); echo $content['host']; ?>"> <?php $content = parse_url(strip_tags(get_the_content())); echo $content['host']; ?></a> </li> <?php endwhile;?> I've Googled around for a while, reading posts about how to prevent duplicate posts in multiple loops but can't adapt it to mine. I'd really appreciate any advice. Cheers, Craig.
×
×
  • 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.