The following code gets stripped down at runtime:
$PhoneHomeLink=CHtml::link($this->phone_home,'tel:'.$this->phone_home);
Assuming the home phone number is 999-555-1212 the output is displaying:
<a>999-555-1212</a>
What happened to the:
999-555-1212
Hi I thought this would be easy but I guess it's more work than I planned. Does anyone have any ideas?
OK for anyone interested, I tested the function in a few different places and it worked so I figured out it was implementation on my end.
I wanted to create tel: links inside CGridview with the following code:
'home'=>array('type'=>'html','name'=>'home_phone','value'=>'CHtml::link($data->phoneHome,"tel:".$data->phoneHome)','htmlOptions'=>array('width'=>'120')),
and after scratching my head and digging and digging I found out the alternate 'type' called raw which worked magic in this situation. I just needed one item in that line changed as shown here:
'home'=>array('type'=>'raw','name'=>'home_phone','value'=>'CHtml::link($data->phoneHome,"tel:".$data->phoneHome)','htmlOptions'=>array('width'=>'120')),
For Yii 2.x CHtml() is deprecated.
Use Html(). Here what I use in a DetailView::widget() for a phone number to be called.
['attribute' => 'CW_phone',
'format' => 'raw',
'value' => Html::a($model->CW_phone,"tel:".$model->CW_phone),
],
Related
I need to debug some errors and formatting within a professional wordpress site. I need to do the debugging from the raw code. It is mostly php and JS. I have ended up with more than 2million lines of code after the most recent update. There are some empty box space on the home page and a list of bugs from the WP_DEBUG log.
This is my first time working with Wordpress at all. I am overwhelmed by the amount of code, and can't figure out where any of the bugs and issues are. I have worked with Angular Typescript in the past.
I would assume, to an extent, that some of these issues would be able to be fixed within the 'drag and drop' API of wordpress, but I have no idea how to use that either, when there is an already several million lined website code, and like I said, I was given the raw php code of over 2 mil lines to debug with.
I have been using VS code for the editor and MAMP as a live server.
I have no idea where to start, and I have not been able to find any useful tutorials online. Any help is greatly appreciated. I could really just use some guidance on how this process might work. Or if it even is something that people do, ever. It looks like according to the internet, this may not be the way to go about debugging. Feel free to ask questions I'll try to answer anything I can without giving away any confidential info.
Here are the bugs that show up on the site from WP_Debug:
Warning: preg_match(): No ending delimiter '*' found in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Warning: preg_match(): Empty regular expression in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Notice: Trying to get property 'Location' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 45
Notice: Trying to get property 'Subrole' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 46
Update: I am still having issues with these same errors. I am looking for assistance on how the process of debugging raw WP php code works, and if I am trying the right things. I can provide the code that a few errors are pointing to, but I do have to adjust the variables to maintain confidentiality.
\Child-Theme\functions.php (35-50):
if(class_exists(\RoleList\RoleList::class)) {
wp_localize_script('site-name', 'SiteName', [
'RoleList' => [
'categories' => $role_categories,
'locations' => \RoleList\Categories::getLocations(),
'category_counts' => \RoleList\Listings::getCategoryCounts(),
],
'CurrentRole' => [
'is_role_page' => ($listing ? true : false),
'current_category' => ($current_category ? $current_category : null),
'current_location' => ($listing->Location ? $listing->Location : null),
'current_subrole' => ($listing->Subrole ? $listing->Subrole : null),
'home_url' => home_url(),
]
]);
}
I'm trying to make Youtube v3 Data API work on my website.
I shamelessly copied this code from google's code samples, and it is not working. The error message showed is this:
An client error occurred: All cacheable requests must have creation dates.
I previously had issues with API keys as I forgot almost everything about APIs in general and I just thought this sample would have been useful to remember things. I managed to generate the appropriate key and now I know for sure it isn't the real problem.
Sadly Google didn't find posts related to this issue, except two links to the actual Php Library that I implemented in my site to make everything work. By looking at it closely I noticed a developer comment that could be useful.
$rawDate = $resp->getResponseHeader('date');
$parsedDate = strtotime($rawDate);
if (empty($rawDate) || false == $parsedDate) {
// We can't default this to now, as that means future cache reads
// will always pass with the logic below, so we will require a
// date be injected if not supplied.
throw new Google_Exception("All cacheable requests must have creation dates.");
}
I can understand english pretty well but I really don't know what to do now.
I even tried to add some sort of date in the request in my code, but it isn't working (you can laugh):
// Call the search.list method to retrieve results matching the specified
// query term.
$searchResponse = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
'date' => strtotime(),
));
An client error occurred: (list) unknown parameter: 'date'
Any tips? Thank you in advance
EDIT: I know, this PHP library is currently in beta, but there must be some workaround.
EDIT 2: I found a temporary work around. I inverted the logic gate of that 'if' in the Php Library and now it works. But I don't like doing this, and I won't mark this as solved. At least if you know the reason of the bug please explain it to me, I'm really interested.
I'm trying to add some extra columns to an existing table with the codeigniter dbforge way.
I'm doing everything like this here. dbforge,add_column.
It wasn't working with the migrations, but after i tried to put the exact same code into some of my controllers with profiler turned on.
After this, i saw this info on the queries part. (Attaching an image)
I saw something like that in the buglist, but there it is fixed. So after this i tried to download a git version from codeigniter, but there is the exact same problem.
The code i'm trying to run is this:
$fields = array(
'preferences' => array('type' => 'TEXT')
);
$this->dbforge->add_column('users', $fields);
I'm sure that is something with the file at system/database/DB_forge.php file, but i wasn't able to resolve it.
Could someone point me in the good direction? Is something i'm doing wrong? Is something missing?
Thanks in advance for your kind help of all.
I'm stuck at the beginning of a new site.
It's my first time, trying to use oil for generation / migration.
I successfully create a model using oil and now I want to migrate it, but
php oil refine migrate
gives me an error:
Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 94
With a little bit of research I found out, that at least I'm not completely alone with this error, though none of the discussions I saw has been solved so far.
My db-configuration is all fine and regarding some hints I even overwrote php-cli's php.ini with the one, apache is using.
But no luck at all.
Anybody out there, who knows a solution? Any help appreciated!!!
EDIT:
I wanted to go on developing even without oil but now found that I can't even run migration from php. It's the same error message which doesn't help at all.
Please guys, anybody just has to know a solution...
have you set the database conneection in the file: fuel/app/config/development/db.php? and is in the correct form:
return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=fuel_intro',
'username' => 'root',
'password' => '',
),
),
);
By the error it sounds like you may have the wrong sytax in your config.
I hope this is helpful, if not please post your db config file source.
I am consistently getting an error when navigating between CakePHP plugins (that I coded).
I bootstrap them like this:
CakePlugin::loadAll(array(
'OneTime' => array('bootstrap' => true),
'Mango' => array('bootstrap' => true),
'Intercape' => array('bootstrap' => true)
));
I link to them like this:
echo $this->Html->link($image,array('plugin'=>'intercape','controller'=>'tickets','action'=>'StepOne','agent'=>FALSE),array('escape'=>FALSE));
echo $this->Html->link($image,array('plugin'=>'mango','controller'=>'tickets','action'=>'StepOne','agent'=>FALSE),array('escape'=>FALSE));
I can clear my cache and navigate to a plugin, but if I use a link like the following one to go to the home page then the next time I try to click the other link I get a bug.
Clicking this link
echo $this->Html->link($image,array('plugin'=>'','controller'=>'agentusers','action'=>'dashboard','agent'=>TRUE), array('escape'=>FALSE));
gives this bug the next time I click the Intercape link (not the Mango link)
Fatal error: Class 'MangoAppController' not found in /var/www/mtn/app/Plugin/Mango/Controller/TicketsController.php on line 12
I have checked that Intercape does not reference Mango anywhere. Clearing my cache lets me click Intercape and use the plugin, but then Mango won't work.
It turns out that the problem was in using the same controller name in different plugins.
Cake was caching where to look for controller source across plugin requests and so was looking for the wrong code.
Renaming the controller solved the problem, but made the URL's a bit messy :(