Current location: Hot Scripts Forums » Programming Languages » PHP » [Newbies]Parse error: syntax error, unexpected '(', expecting T_STRING


[Newbies]Parse error: syntax error, unexpected '(', expecting T_STRING

Reply
  #1 (permalink)  
Old 10-21-07, 01:08 AM
pakdoz pakdoz is offline
New Member
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question [Newbies]Parse error: syntax error, unexpected '(', expecting T_STRING

Please help...
I got error when trying modify a php file.

Error:
Parse error: syntax error, unexpected '(', expecting T_STRING in /home/indotux/public_html/olate/includes/url_factory.inc.php on line 24


Code:

PHP Code:

<?php


// include config file
require_once 'config.inc.php';

// prepares a string to be included in an URL
function _prepare_url_text ($string)
{
  
// remove all characters that aren't a-z, 0-9, dash, underscore or space
  
$NOT_acceptable_characters_regex '#[^-a-zA-Z0-9_ ]#';
  
$string preg_replace($NOT_acceptable_characters_regex''$string);

  
// remove all leading and trailing spaces
  
$string trim($string); 

  
// change all dashes, underscores and spaces to dashes
  
$string preg_replace('#[-_ ]+#''-'$string); 

  
// return the modified string
  
return $string;
}

// builds a link that contains a category and a product
function (make_category_product_url($file['cat_name'], $file['cat_id'], $file['name'], $file['id']))
{
  
// prepare the product name and category name for inclusion in URL
  
$clean_category_name _prepare_url_text($file['cat_name');
  
$clean_product_name _prepare_url_text($file['name']);

  
// build the keyword-rich URL
  
$url SITE_DOMAIN '/1/' 
         
$clean_category_name '-C' $file['cat_id'] . '/' 
         
$clean_product_name '-P' $file['id'] . '.html';

  
// return the URL
  
return $url;
}

// builds a link to a media file
function (make_media_url($id$name$extension))
{
  
// prepare the medium name for inclusion in URL
  
$clean_name _prepare_url_text ($name);

  
// build the keyword-rich URL 
  
$url SITE_DOMAIN '/' $clean_name '-M' $id '.' $extension;

  
// return the URL
  
return $url;
}

?>
Reply With Quote
  #2 (permalink)  
Old 10-21-07, 06:39 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Replace.
PHP Code:

function (make_category_product_url($file['cat_name'], $file['cat_id'], $file['name'], $file['id'])) 

With
PHP Code:

function make_category_product_url($file['cat_name'], $file['cat_id'], $file['name'], $file['id']) 

Reply With Quote
  #3 (permalink)  
Old 10-22-07, 11:34 AM
Socca Socca is offline
Newbie Coder
 
Join Date: Jun 2007
Location: Brasschaat, Antwerp, Belgium
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
nico what do you use to identify these errors? some sort of program or just your own eyesight?
Reply With Quote
  #4 (permalink)  
Old 10-22-07, 11:50 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Eyesight.

Once you get more into programming you'll know the right syntax and you'll see what's wrong.
Reply With Quote
  #5 (permalink)  
Old 10-23-07, 02:07 PM
Socca Socca is offline
Newbie Coder
 
Join Date: Jun 2007
Location: Brasschaat, Antwerp, Belgium
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
ah dammit ! no shortcut
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 07:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.