General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 28th, 2003, 10:57 PM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Autolink

I have a question. How a can do autolink? For example, if I wrote 'INTEL', it must changing on the www.intel.com.
But if I wrote Intel Pentium it mustn`t change.

Reply With Quote
  #2  
Old October 29th, 2003, 06:34 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
what i would do

okay here is what I have done for my site, and you can see it other places...

I have a table, call it tags. In the table I have two rows, tag, and replace, or something to that affect. In the tag row I place
<a href="
then I have another one
">
and one more
</a>

now in replace, I have
[link], [midlink], [/link]

in the page, I use
PHP Code:
<?php
// Query the database, and assign the result-set to $result 
$query "SELECT * FROM tag"
$tag mysql_query($query); 

// Loop through the results, and place the results in two arrays 
while($tagRow mysql_fetch_array($tagMYSQL_ASSOC))
    {    
$tags[] = $tagRow['tag']; 
        
$replaceTag[] = $tagRow['replace'];
        
$spacer[] = ' ';
        
$liner[] = '_';
    } 
?>

and finally, in the text you want to replace the tag in,

PHP Code:
/*this replaces anything in $userinfo (which needs to be selected
from db) that matches something in $replaceTag with
corrosponding value from $tags...*/

echo str_replace($tags$replaceTag$userInfo); 


Now the user basically writes this when they want a link:

[link]www.intel.com[midlink]Intel.com[/link]

I jsut placed a link, and this isn't what devarticles does... but it will look like this anyway!

intel.com\

this is useful for other replacing methods, which is why I use it, although a quicker way of linking would be better maybe. But this is what I do.
__________________
hey it's the CHARKING

Reply With Quote
  #3  
Old November 1st, 2003, 05:26 AM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank. But...
If I write Intel Pentium then script will show intel Pentium, but I need that if I want say about company it must change, but if write about company product it mustn`t change.

And also, how I can do that in the final os story script write last news on this topic. For example, If write about Intel company script must wtite last news about Intel.

Reply With Quote
  #4  
Old November 1st, 2003, 05:13 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
okay, well with the metod I descrived, it wouldn't change intel pentium to intel pentium, only if you wrote:
[link]http://www.intel.com[midlink]intel[/link] pentium...
get it? It depends on repacing the bracketed words with html...
an dI really didn't understand your second question, can you try to clarify? thanks

Reply With Quote
  #5  
Old November 2nd, 2003, 01:06 AM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
an dI really didn't understand your second question, can you try to clarify


Yes, of course. My english is bad, sorry

I wanted say: "Related topics"

For example, as on www.theinquirer.net, where in the final of story script put links on news of that subject.

Look: subject of article - "New processors from Intel" and in the end of story will be write :

"New processors from AMD"
"New chip from Intel"
e.t.c

Thank.

Reply With Quote
  #6  
Old November 2nd, 2003, 07:30 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
hmm I've never thought about it, but here is my guess:

i would say that if this is news you are CREATING, just have a news title (which I'm sure you would anyway), and after you have set all that up, do this query:

PHP Code:
//$title is already queried, then to get realted...

echo 'related searches...';

$getRelated mysql_query("SELECT newsId, newsTitle FROM news WHERE newsTitle LIKE %'" $title "'%");

while(
$relatedTitle mysql_fetch_array($getRelated))
     {
echo 
'
<a href="news.php?
newsId=' 
$relatedTitle['newsId'] . '">' 
$relatedTitle['newsTitle'] . '</a>'; } 


this should query the table for titles similar to the one you
already queried for. If a user were to search, simply use the search terms instead of the $title. Hope this helps, and works. I have never thought of it before, I think I should do something like this!

Reply With Quote
  #7  
Old November 2nd, 2003, 09:52 PM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok. Thank.
But I decided, that i will use else one field - meta. When author publish news, he must obliged to fill in a field Meta.
When he will posting script sends query to MySQL.
News with identical meta will write bellow.

How are you think: what more preferable for news storage: text(*.php, *.html, *.txt) file or database?


Now I use text files but I think that better is a MySQL.

Reply With Quote
  #8  
Old November 4th, 2003, 02:43 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
hmm, i don't know much about the differences between text and database. but I'l go start a thread for us on it, cause I'm interested also!
edit:
here is the link to the thread:
text vs database

Reply With Quote
  #9  
Old November 4th, 2003, 10:20 PM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I will use and database and text file.

Thank you thecharking

Now I am ready to the next feats

Oh, look here

$topic_title = "How change button colors in 2.0.6";
$topic_title_ar = explode(" ", $topic_title);
while (list ($line_num, $line) = each ($topic_title_ar)) {
$topic_title_some =
trim("$line");
}

where mistakes?

Reply With Quote
  #10  
Old November 5th, 2003, 03:52 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
sorry i'm not very good at php, that didn't make much sense to me... uh, what does it do? does it give errors? you may need to enlist someone a bit more proficient in php... sorry.

Reply With Quote
  #11  
Old November 5th, 2003, 04:01 AM
wolandin wolandin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 13 wolandin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
nothing...
Thank you.
You helped me.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Autolink


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT