Hello, thanks to everyone who is trying to help me, but this is all
Greek to me, so I'll post the PHP code, if anyone would like to take
a crack at it, please feel free. :)
The part of the code in question is near the bottom, it has 2 places
where it references replacing the blank spaces with underscores,
this is where I would assume that the other stuff I want would be
inserted, I have tried, I just don't get it right:
****************************************************
<?php
include_once("config.php");
global $USER_VAR;
$USER_VAR['SAVE_DIR']=$_POST['savedir']."/";
include_once("sql.php");
include_once('mine_index.php');
include_once('mine_content.php');
include_once('file_sys.php');
//print_r($_POST);
global $db_list;
$db_list['db_name']=$USER_VAR['SQL_DB'];
$db_list['article']="asb_articles";
$db_list['tags']="asb_sourcetags";
$db_list['search']="asb_search";
$db_list['cat_articlecity']="asb_cat_articlecity";
$db_list['cat_ezinearticles']="asb_cat_ezinearticles";
$db_list['cat_goarticles']="asb_cat_goarticles";
//SET THE USER SAVE DIRECTORY
global $save_dir;
$save_dir=$USER_VAR['SAVE_DIR'];
include_once('search_to_db.php');
if(!is_writable($USER_VAR['SAVE_DIR'])){echo "<b>Your ASB save
directory is not writeable!<br>
Please give the directory "".$USER_VAR['SAVE_DIR']."" write
permissions.<br><a href='readme.html'>Refer to the README file for
setup instructions.</a><br>";
die();}
//SET THE ARTICLE TEMPLATE
if ($_POST['a_paste']!=""&&$_POST['a_url']=="")
{$template=$_POST['a_paste'];}
if ($_POST['a_url']!="")
{$template=file_get_contents($_POST['a_url']);
$save_a_temp=$_POST['a_url'];}
if ($_POST['a_select']!="")
{$template=file_get_contents($_POST['a_select']);
$save_a_temp=$_POST['a_select'];}
//SET THE INDEX TEMPLATE
if ($_POST['i_paste']!=""&&$_POST['i_url']=="")
{$i_template=$_POST['i_paste'];}
if ($_POST['i_url']!=""&&$_POST['i_paste']=="")
{$i_template=file_get_contents($_POST['i_url']);
$save_i_temp=$_POST['i_url'];}
if ($_POST['i_select']!=""&&$_POST['i_paste']=="")
{$i_template=file_get_contents($_POST['i_select']);
$save_i_temp=$_POST['i_select'];}
save_search($_POST,$save_a_temp,$save_i_temp);
//$template_i=file_get_contents("index_template.html");
//echo "index:<br>".htmlentities($i_template);
//if(i_template=='')die(echo"Index Template EMPTY!";)
// INIT list of HREF LINKS FOR INDEX PAGES
global $hrefs;
$hrefs= array();
//DO SEARCH ON GOARTICLES.COM
if($_POST['goarticles_cats']!=""){
set_mine(2);
$ga_links=get_some_links(2,$_POST['goarticles_cats'],$_POST
['total']);
//echo "<br>main start <br>";
//print_r($ga_links);
//CREATE PAGES FOR EACH LINK UP TO THE NUMBER SELECTED
$count=1;
while ($count<=$_POST['total'])
{$html=$template;
$data=get_article_data(array_shift($ga_links));
//echo "got article<br>";
$data['title']=substr($data['title'], 1);
//print_r($data);
parse_article($data,$html);
$count++;
}//END WHILE
}//end IF
//DO SEARCH ON ARTICLECITY.COM
if($_POST['articlecity_cats']!=""){
include ('get_ac_links.php');
$city_links=get_ac_links($_POST['articlecity_cats'],$_POST['total']);
//print_r($city_links);
//CREATE PAGES FOR EACH LINK UP TO THE NUMBER SELECTED
$count=1;
while ($count<=$_POST['total'])
{$html=$template;
set_mine(0);
$data=get_article_data(array_shift($city_links));
//echo $data['title']."<br>";
parse_article($data,$html);
$count++;
}//END WHILE
}//END if
//echo"hrefs:<br>";
//print_r($hrefs);
write_index($hrefs,$i_template,$_POST['link_num']);
include ('success.html');
die();
function write_index($href,$template,$perpage)
{
//echo "WRITEINDEX:<bR>";
//print_r($href);
//echo "WRITEINDEX:<bR>";
/*$dir_list=get_save_file_list();
foreach ($dir_list as $url)
{
$now="<a href='".$url."'>".$url."</a>";
$linked[].=$now;
}
$full_list=array_merge($href,$linked);
$href=array_unique($full_list);
*/
//print_r($dir_list);
$index_array=paginate_indexes($href,$template,$perpage);
$existing_i=get_index_list();
//print_r($existing_i);
//print_r($index_array);
$link_string="";
$i=1;
//$nav_string="<!-- ASB GENERATED CONTENT DO NOT ALTER --!>\n";
$nav_string .="<!-- #start_nav# --!>\n";
while (sizeof($index_array)>=$i)
{
if ($i==1){$filename="index.html";}
else {$filename= "index$i.html";}
$link_string.=" <a href=\"".$filename."\">".$i."</a> \n";
$i++;
}
$i=sizeof($existing_i);
while (sizeof($index_array)<$i)
{ $link_string.="APPEND";
if ($i==1){$filename="index.html";}
else {$filename= "index$i.html";}
$link_string.=" <a href=\"".$filename."\">".$i."</a> \n";
$i++;
}
//echo $link_string."_<br>";
if (sizeof($existing_i)>=1)
{update_indexes($link_string,$existing_i);}
$nav_string .=$nav_string.$link_string."<!-- #end_nav# --!>\n";
$nav_string .="<!-- END ASB GENERATED --!>";
//CREATE LINK LIST FOR EACH PAGE
$count=1;
foreach ($index_array as $page)
{ $link_string="<!-- ASB GENERATED CONTENT DO NOT ALTER --!>\n";
$link_string .="<!-- #start_links# --!>\n";
while (sizeof($page)>=1)
{
$link = array_shift($page);
if($link!=""){$link_string .= $link."<br>\r";}
}
$link_string .="<!-- #end_links# --!>\n";
//$link_string.="<!-- END ASB GENERATED --!>";
//MAKE/SAVE PAGE WITH $link_string.
if ($count==1){$filename="index.html";}
else {$filename= "index$count.html";}
//echo "<u>$filename:</u><br>".$link_string."<br>\r".$nav_str
ing."<br>";
//global $save_dir;
//echo $save_dir."<br>";
//$path=$save_dir.$filename;
//echo $path."<br>";
/*if (find_file($filename)==TRUE)
{global $USER_VAR;
//print_r($USER_VAR);
$index_html=file_get_contents($USER_VAR['SAVE_DIR'].$filename);
$open="<!-- #start_links# --!>";
$close="<!-- #end_links# --!>";
$html=replace_text($open,$close,$link_string,$index_html);
$open="<!-- #start_nav# --!>";
$close="<!-- #end_nav# --!>";
$files_there=get_save_file_list();
//$html=append_text($open,$close,$nav_string,$index_html);
}*/
$all_text=$link_string."<br>".$nav_string."<br>";
$html=str_replace("%%%Links%%%",$all_text,$template);
if (!write_file($html,$filename)) {echo "<!--cant save
file:$filename.-->";}
$count++;
}
}//END FUNCTION
function paginate_indexes ($hrefs,$template,$perpage){
$index_pages=array();
$size=sizeof($hrefs);
$wcount=0;
while (sizeof($hrefs)>=1)
{$page=array();
$count=0;
while($count<=$perpage-1)
{
$url=array_shift($hrefs);
$page[].=$url;
$count++;
}
$index_pages[$wcount]=$page;
$wcount++;
}
return $index_pages;
}//END FUNCTION
function update_indexes($i_string,$list)
{//echo $i_string."<br>";
foreach ($list as $page)
{
$contents = read_file($page);
$start_tag="<!-- #start_nav# --!>\n";
$end_tag="<!-- #end_nav# --!>\n";
$new=replace_text($start_tag,$end_tag,$i_string,$contents);
write_file($contents,$page);
}
}
function parse_article($data,$html)
{//echo "parsing : ".$data['title']."<br>";
global $_POST;
//$link="articles/";
if (($_POST['discard']!="")&&(strstr($_POST['discard'],","))){
$nos=explode(",",$_POST['discard']);
foreach ($nos as $look)
{
//echo "looking for: ".$look."<br>";
if (strstr("\ ".$data['text']."\ ",$look)!=false){
//echo "discarded: found ".$look."<br>". $data['url']."<br>";
return;}
}}
//FILL IN THE TEMPLATE
$html=str_replace("%%%Title%%%",$data['title'],$html);
$html=str_replace("%%%Author%%%",$data['author'],$html);
$html=str_replace("%%%Article%%%",$data['text'],$html);
$html=str_replace("%%%Resource_Box%%%",$data['resource_box'],$html);
//echo("______________<BR>".htmlentities($html)."______<BR>");
$file_name=save_article($html,$data['title']);
if ($_POST['link_length']<strlen($data['title']))
{
$href_text=substr($data['title'],0,$_POST['link_length']);
}
else
{$href_text=$data['title'];}//END ELSE
//PREP FOR LINKS
$href_text=str_replace(" ","_",$href_text);
global $hrefs;
//GENERATE AN HREF LINK AND ADD TO GLOBAL ARRAY
$hrefs[].="<a href='".urlencode($file_name)."'>".$href_text."</a>";
//SAVE THE ARTICLE INFO TO THE DB
if(put_article($data)==true){//echo"article saved to DB<br>";
}
}
function save_article($html,$title)
{//echo "saving $title<br>";
global $save_dir;
$filename=substr(str_replace(" ","_",$title),0,20).".html";
//$path=$save_dir.$filename;
//echo $filename."__path__<br>";
if (!write_file($html,$filename)) {echo "cant save
file:$filename. ";return false;}
else {return $filename;}
}
?>
*************************************************
The things I want are:
1. Replace the uppercase with lower case
2. Remove unwanted characters [EMAIL PROTECTED]&*()+=\/`{}[]:;"'?<>
3. Remove unwanted words: to, the, it, and, or, with, too, also, an,
if
Thanks everyone! Oh, if it would help, I can email a copy of all the
files that came with this program, I have the rights to it, so it OK
to do.
Thanks again.
Wretha
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/