how to change html file with url get id in php - ajax

For example I have two html files sample1.html and sample2.html and I want to show them in one php file, like if I entered www.mydomain.com/index.php?show=sample1 will show the sampl1.html and ?show=sample2 will show sample2.html but in only one page

Something like that ?
<? include($_GET['show'].".html"); ?>
It not the a secure answer but I think this is what you want...

Related

php preg_match value within multiple div

I want to extract the version number of a webserver. the version number is showed on the admin login page.
i tried this:
$content = file_get_contents('URL/login.jsp');
preg_match("/<div class=\"product-version\".*div>/", $content);
echo "content: $content";
It does show the version number but also a large part of the rest of the page.
part of the page i want to have preg_match look in:
<div class="product-logo" style="background-image:url(images/product/icon-system-admin.png)">
<div class="product-version">10.3</div>
</div>
</h2>
Is this possible? or to edit the preg_match to just use the 4 characters after product-version is found?
#Toto that solved it, thanks!
Next thing is to get this working for a bunch of urls.
Want to have the script read urlcustomers.txt in the same directory and show all the version of the webserver for each customer in a table.

Allow HTML input in Joomla Contact input fields

By default, Joomla seems to strip and remove any HTML content entered into the Contact details.
I want to add line breaks to the address textarea box. Now, I understand I need to add filter="raw" to the XML file, which would mean hacking the core. (from this article: http://docs.joomla.org/Textarea_form_field_type)
Is there anyway to do this via an override instead?
My idea :
Make an overide of this file : "components\com_contact\views\contact\tmpl\default_address.php"
Replace <?php echo $this->contact->address .'<br/>'; ?> by <?php echo str_ireplace('-br-' ,'<br />', $this->contact->address) .'<br/>'; ?>
When you provide an adress, write "-br-" for each break line.

Remove Trailing Slash from Magento URL

I understand there are many answered questions on this particular issue but I haven't found anything specific to Magento, and I was wondering if changing the .htaccess file will have repercussions in my Magento store.
Basically I have links in my navigation that go straight to a filtered category page so they look as follows..
Example.com/hairproducts.html?manufacturer=412
However when I click these links they end up navigating to the URL with a trailing slash...
Example.com/hairproducts.html?manufacturer=412/
which then ignores the filter and takes them to the category page.
Cheers for any help.
I assume you have the urls generated in a phtml file like this:
<?php echo $this->getUrl('hairproducts.html?manufacturer=412'); ?>
or in a block/page content like this
{{store url="hairproducts.html?manufacturer=412"}}
Change them to this:
In a phtml file:
<?php echo $this->getUrl('', array('_direct'=>'hairproducts.html', '_query'=>'manufacturer=412'); ?>
or in a block/page content
{{store _direct="hairproducts.html" _query="manufacturer=412"}}
If I assumed wrong then post the way you are generating the urls.

change a GET method URL to SEO URL in Joomla 3 component

I want to send a parameter form a module to a component in Joomla 3 (it's a date to show its articles).
So I send the date by GET Method like this:
<a href="http://127.0.0.1/web43/archives.html?date=2014-12-29&option=com_arch&Itemid=10371">
list of articles on 2014/12/29
</a>
Everything works. I can get parameters on PHP file in model folder in com_arch component...
but this URL is ugly and unfriendly for search engines.
I want something like this:
<a href="http://127.0.0.1/web43/archives/2014-12-29">
list of articles on 2/2/2014
</a>
Is it possible? How can do it?
Hope this helps:
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
Its about router.php file.

Codeigniter URL for navigation

I can't figure out how to do the url links.
Basically I have my navigation bar, and I don't know which CodeIgniter URL code to use and how to implement it.
Is what I'm doing here right?:
<?php $this->load->helper('url'); ?>
<li>About Us</li>
I tried to do an anchor like this, but when I load the page it just turns up blank:
<?php echo anchor('views/about.html', 'About Us', title='About Us'); ?>
What am I doing wrong?
There are two ways to make links:
CodeIgniter helper style:
<?php echo anchor('about', 'About us', 'title="About us link"'); ?>
More common HTML with URL echo:
About us
Both will output:
About us
Though if I understand what you are trying to achieve, your mistake is elsewhere.
You don't include the views part, as your URL should point to the controller, not a view. The only case is if you have a controller named views.
CodeIgniter is set up so that it doesn't include file extensions like .html in URL's by default. It does if you've set them up in your config file in $config['url_suffix'] = '';, which is null by default.
See if you've made any of these mistakes.
That is another way on how you do the URL if you are using the URL helper in CI. You should try this, make the base_url() as the value for href. Try this,
About Us
You have to try like this
About Us
or you can give like
About Us
and in the "about" function you put
$this->load->view('about');
but i think the firstone will works for you fine.

Resources