Skip to content

Instantly share code, notes, and snippets.

View chetanmadaan's full-sized avatar

Chetan Madaan chetanmadaan

View GitHub Profile
@chetanmadaan
chetanmadaan / menu.php
Created September 4, 2019 17:33
continue 2 for helix menu.php on PHP 7.3
<?php
/**
* @package Helix3 Framework
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2018 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/
//no direct accees
defined ('_JEXEC') or die ('resticted aceess');
@chetanmadaan
chetanmadaan / blog.php
Created October 10, 2019 23:20
blog.php fix.
<?php
/**
* @package Astroid Framework
* @author JoomDev https://www.joomdev.com
* @copyright Copyright (C) 2009 - 2019 JoomDev.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/
defined('_JEXEC') or die;
?>
<div class="blog<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="https://schema.org/Blog">
@chetanmadaan
chetanmadaan / listarticles.php
Created November 11, 2019 03:18
Joomla 4 API to list all articles
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// No Edits below this line needed.
$curl = curl_init();
@chetanmadaan
chetanmadaan / listarticlesresponse.php
Created November 11, 2019 03:34
Listing articles via Joomla 4 API - Response
{
"links": {
"self": "http://localhost/j4a12/api/index.php/v1/content/article",
"first": "http://localhost/j4a12/api/index.php/v1/content/article?page[offset]=0&page[limit]=20",
"next": "http://localhost/j4a12/api/index.php/v1/content/article?page[offset]=20&page[limit]=20",
"previous": "http://localhost/j4a12/api/index.php/v1/content/article?page[offset]=0&page[limit]=20",
"last": "http://localhost/j4a12/api/index.php/v1/content/article?page[offset]=0&page[limit]=20"
},
"data": [
{
@chetanmadaan
chetanmadaan / accessinglearticle.php
Created November 11, 2019 03:41
Access Single article - Joomla 4 API
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// ID of the article you want to access
$articleid = 6;
// No Edits below this line needed.
$curl = curl_init();
@chetanmadaan
chetanmadaan / accesssinglearticleresponse.json
Last active November 11, 2019 03:44
Access single article response - Joomla 4 API
{
"links": {
"self": "http://localhost/j4a12/api/index.php/v1/content/article/6"
},
"data": {
"type": "articles",
"id": "6",
"attributes": {
"typeAlias": "com_content.article",
"id": 6,
@chetanmadaan
chetanmadaan / deletearticleviaapi.php
Created November 11, 2019 04:27
Delete article via Joomla 4 API
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// Article id to Delete
$articleid = 15;
@chetanmadaan
chetanmadaan / .htaccess
Created February 27, 2020 21:43
.htaccess redirect thingy.
# Redirect HTTP with www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTP without www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTPS without www to HTTPS with www
RewriteCond %{HTTPS} on
@chetanmadaan
chetanmadaan / formatphone.php
Last active March 12, 2020 18:34
Phone Formatted in US format
<?php
if(!empty($phone)) {
$formatedphone = "(" . substr($phone, 0, 3) . ") " . substr($phone, 3, 3) . "-" . substr($phone, 6);
}
?>
@chetanmadaan
chetanmadaan / social-links.php
Created April 29, 2020 20:00
Overriding Layouts with JD Builder.