Joomla Component adds underscore automatically - php

This is a weird issue I ran into. Most likely something I am missing but after a few hours and searching over 200 files, I cannot find ANY reason for this to happen (yet it is anyway).
The amazing problem is that I have an override created for com_finder, I am doing this because you can only setup com_finder in one context and the site I am working on needs 2. So I copied com_finder and renamed it to com_finderhmg and did some find and replace to make it work exactly the same, just a different name and its own db tables.
Anyway it loads up fine but when I go to index I get a JS error from mootools, it basically says that a dom element does not exist (finderhmg-progress-container). Looking in the file i see that it is indeed there, but only in the source file, when I view source on the page it shows up as finder_hmg-progress-container.
Anyone else have this happen to them before? Or a something I might just be missing without realizing?
Here is the source file
<div id="finderhmg-indexer-container">
<br /><br />
<h1 id="finderhmg-progress-header"><?php echo JText::_('COM_FINDERHMG_INDEXER_HEADER_INIT'); ?></h1>
<p id="finderhmg-progress-message"><?php echo JText::_('COM_FINDERHMG_INDEXER_MESSAGE_INIT'); ?></p>
<form id="finderhmg-progress-form"></form>
<div id="finderhmg-progress-container"></div>
<input id="finderhmg-indexer-token" type="hidden" name="<?php echo JFactory::getSession()->getFormToken(); ?>" value="1" />
</div>
And the view source
<div id="finder_hmg-indexer-container">
<br /><br />
<h1 id="finder_hmg-progress-header">Starting Indexer</h1>
<p id="finder_hmg-progress-message">The indexer is being initialized. Do not close this window.</p>
<form id="finder_hmg-progress-form"></form>
<div id="finder_hmg-progress-container"></div>
<input id="finder_hmg-indexer-token" type="hidden" name="95b922cc6e0f81d18fd1e23e75a09d5f" value="1" />
</div>
There is no other file for the indexer, at least not that I know of (mass search of pretty much all of joomla yielded nothing).

This is very strange. However let's look at it the other way around. If your component outputs the code correctly, there can be only one piece of code that can change it, and that's a plugin (either a content plugin or a system plugin).
Try disabling all 3rd party content or system plugins until you find the one responsible for this behaviour.

Related

Change color of checkbox input in HTML/PHP

I am fairly new to programming websites so this might be a stupid question, but I can't seem to change the color of a checkbox I have where user should accept privacy policy. The code is placed in a .PHP file.
Code
Here is what I have now:
<label class="custom-control custom-checkbox mb-0">
<input type="checkbox" class="custom-control-input" id="privacypolicy" value="1" tabindex="20" onchange="jQuery('#privacypolicy').prop('disabled', false);" data-fieldblock="block<?php echo $i; ?>">
<div class="custom-control-label mr-2"> <?php echo __("Accept","premiumpress") ?> <?php echo __("<b>Privacy policy</b>","pp") ?> </div>
</label>
What I tried
I have been Googling for ages now and all I find is people saying to add CSS. But where would I do this? I can't just add it in html/php file, when I tried it of course didn't recognize it as code. I don't want to change some style CSS since I only want to change background color on this specific place. I can't seem to add an attribute to my like background-color="000000" either.
What I want
Just change background color of checkbox on this specific place. I don't know if the code provided is enough, please let me know in comments if you need any more details.
Though it is easier than it was in the past, adding custom styling to the browsers default input fields is not as easy as it might sound. In other words, changing the color of a checkbox seems like it should be super simple but in reality you have to use quite a bit of CSS styling. Here is a nice article that provides some examples of how to do it:
https://css-tricks.com/custom-styling-form-inputs-with-modern-css-feature
As #jaspal mentioned in his comment, you need to add css to the html output. Once you do, you can use the css styling rules in the article to target specific inputs and style them. If you are just trying to style checkboxes and not the other input types, this is a good primer: https://www.w3schools.com/howto/howto_css_custom_checkbox.asp
Try the accent-color property instead of background-color
Full description here

PHP file with accompanying compiled file

I have inherited a php system written using Smarty. The code is split into class files and templates which I can work my way through. However, for each template file, there is another file written similarly to the template file but with a strange name. For example, I have a footer.tpl file with this code:
<div id="footer">
<p class="bold">Class Management, Version 3.6.4 (Version History/Change Log)</p>
<p> </p>
<p><img src="images/design/logo_small.gif" /></p>
<p>Work Limited</p>
<p>Registered Office: Work address</p>
<p>Tel: Work tel</p>
</div>
The accompanying file has the name %%0E^0E4^0E407559%%footer.tpl.php with the following code
<?php /* Smarty version 2.6.19, created on 2013-07-31 13:27:22
compiled from footer.tpl */ ?>
<div id="footer">
<p class="bold">Class Management, Version 3.6.4 (Version History/Change Log)</p>
<p> </p>
<p><img src="images/design/logo_small.gif" /></p>
<p>Work Limited</p>
<p>Registered Office: Work address</p>
<p>Tel: Work tel</p>
</div>
So, my question is, if I create a new template file, how could I create or what would I use to create the accompanying .tpl.php file?
Any pointers at all to give me a direction to start looking in gratefully received.
Many thanks.
That's a cached copy of the file, the variables are filled in (compiled) so next time its called it does not have to be recreated saving load time, processor time, bandwidth. You dont have to create that file your self they are handled internally. (assuming things are set up properly)
footer.tpl has no variables, some what unusual, so its not really an issue, but most template files should (have variables)

WMD editor not working in edit form

I am using WMD editor. This one.
It is working fine. But issue is, i want to get it working with edit form.
Right now i am getting html instead of markdown text.
My code is like following in my edit page.
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input"><?php echo $row['description']?></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
Not sure what is wrong here.
First off: the repository is not maintained (and apparently has not been updated for over 7 years) so you should consider switching to an active branch. WMD was renamed to Page Down but there are many alternative editors out there you can use.
As timclutton commented you are probably storing HTML in your database. WMD does not support conversion from HTML to Markdown. So the best solution would be to store the content as Markdown.
To do this change your create page. Since I have no code I'll just give you an example on how it could look:
<form action="/create" method="POST">
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea name="content" id="wmd-input"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
<button type="submit">Send</button>
</form>
Server-side you can now store the content of $_POST['content'] in your database and later output it exactly the way you are doing it right now to the edit page.
Lastly a security note from the Page Down wiki:
It should be noted that Markdown is not safe as far as user-entered input goes. Pretty much anything is valid in Markdown, in particular something like <script>doEvil();</script>. This PageDown repository includes the two plugins that Stack Exchange uses to sanitize the user's input; see the description of Markdown.Sanitizer.js below.

Links not working in Framework7

I'm developing a web-based application using Framework7 (http://www.idangero.us/framework7/).
I'm doing well but now that I have come to integrate my login/member system I have encountered a problem with hyperlinks.
I've spent couple of hours trying to figure it out but have still come up short.
Basically I have three links:
<div class="pages navbar-through toolbar-through">
<div data-page="index" class="page">
<div class="page-content">
<div class="content-block">
<div class="content-block-inner">
Hello <?php echo htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8'); ?>, secret content!<br />
Memberlist<br />
Edit Account<br />
Logout
</div>
</div>
</div>
Memberlist.php and edit_account.php do not work but logout does.
Visiting the files directly in my browser (eg domain.com/memberlist.php) loads the file. They just do not load from this page so something is clearly wrong with it.
I've tried to include target="_self" and use other styles of linking content as explained in the Framework7 documentation but there is nothing about the problem I'm experiencing.
it important to write exact page name in data-page attribute value
<div class="page" data-page="about">
After digging around some more in the documentation I was able to solve my issue.
Linking in Framework7 requires every page linked to to have some specific code for parsing over AJAX.
<!-- That is all we have in about.html file -->
<div class="page" data-page="about">
... About page content goes here
</div>

Wordpress Contact Form 7 customize HTML output of shortcodes

I would like to customize the HTML output of a Wordpress Contact Form 7 (WPCF7) shortcode itself, i.e. the [file] shortcode. I do not want to modify the surrounding HTML.
So far I've modified the HTML output by changing the contents of the file /contact-from-7/modules/file.php.
My changes will be lost when I update the plugin. So I'd like to implement a more permanent and robust solution, like adding a filter in my functions.php.
What I would like to do (pseudo code - untested code):
add_filter('wpcf7_file_shortcode_handler', 'my_file_sc_handler');
function my_file_sc_handler($html) {
$html = sprintf('<div>my own html</div>');
return $html;
}
I only not need to change the $html returned - no need to touch the remaining code of the wpcf7_file_shortcode_handler function.
My question: How can I customize the Wordpress Contact Form 7 HTML output of the [file] shortcode so that my changes will not get lost when I update the plugin?
Based on the comments and such, although I do not have a solid answer, I think you may find the answer you're looking for with this link:
http://www.featheredowl.com/contact-form-7-submit-button-element/
This tutorial explains how to manipulate the [submit] shortcode from using <input type="submit"> to a <button> element.
Using this basis, you may be able to customise your [file] output to how you want.
Although this does require editing core files, it also seems to set about handing upgrades of the plugin through functions.
Hope it helps somewhat!
Firstly it is a very bad idea to change the core files of any plugin.
If it is simply the HTML output that you want to change, why don't you change it in the provided editor, see below example:
<div class="row">
<div class="col-md-6">
<p>Name<br />
[text your-name] </p>
</div>
<div class="col-md-6">
<p>Email*<br />
[email* your-email] </p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>Enquiry<br />
[textarea your-message] </p>
<p>[submit "Send"]</p>
</div>
</div>
You can pretty much change everything!
you cannot insert a contact form shortcode into your template file directly. You will need to pass the code into do_shortcode() function and display its output like this
<?php echo do_shortcode( '[contact-form-7 id="7" title="Contact"]' ); ?>

Categories