Welcome Guest, Not a member yet? Register   Sign In
anchor(), scaffolding error
#1

[eluser]Unknown[/eluser]
Hi,
Just started using CI - very nice Smile
A totally default installation gives a warning of:

A PHP Error was encountered
Severity: Warning
Message: preg_match() expects parameter 2 to be string, array given
Filename: helpers/url_helper.php
Line Number: 93

when using the scaffolding.
Tracking back through the code I see the 'view' model in scaffolding uses :

<?php echo anchor(array($base_uri, 'edit', $row->$primary), $scaff_edit); ?>

Would it be useful to add 2 lines of code into the anchor() function in the URI helper as follows:

function anchor($uri = '', $title = '', $attributes = '')
{
if (is_array($uri))
$uri=implode('',$uri); // --EDIT-- :- or perhaps I meant implode on '/' ! I think I probably did Smile
.... existing code ...
}

This would stop the warning message. I don't know if this would affect the code in ways I haven't thought about though !

Regards




Theme © iAndrew 2016 - Forum software by © MyBB