Skip to main content

Making function

More
7 years 5 months ago #4155 by rumdyret
Making function was created by rumdyret
I have an sport and outdoor page.

In the feed there are some baby stuff which I want to exclude. Here I would like to exclude everything with the word baby.


Code:
function sport_cb(&$item) { generic_cb($item); if preg_match("/baby/i",$item['menu_1'] ) { $item['title']=''; } }




There are also a lot of ball activitys in the menu, which I want to put under one menu called ball activities
eg Bolde Håndbold, Bolde Fodbold, Bolde Tennis ... = Ball Activities


Code:
$sport_rename1=array( "Bolde Håndbold"=>"Ball Activities", "Bolde Fodbold"=>"Ball Activities", "Bolde Tennis"=>"Ball Activities", "Bolde Golf"=>"Ball Activities", "Tøj Trusser"=>"remove", "BH Tøj"=>"remove", "BH Ventetøj"=>"remove", ); function sport( &$item) { global $sport_rename1; $m1=strtolower(trim($item['menu_1'])); # rename by lookup table if ( isset($sport_rename1[$m1] ) ) { $n=$sport_rename1[$m1]; if ( $n == 'remove' ) { $item=array(); return; } else { $item['menu_1']=ucfirst($n); } } if ( is_array($item['menu_2'])|| ($item['menu_2']=='Array') ) { $item['menu_2']='uni'; } } function sport_cb( &$item) { generic_cb($item); sport($item); }



I tried to use the build in function fashion_cb from the callback script, which I changed
But no matter how I put the script together, it will not work.

Any suggestions?

Please Log in to join the conversation.

Time to create page: 1.520 seconds