Nowadays, countless software and applications are being developed using open-source code, libraries, and other resources for the fintech domain. These software components cover functions across Contactless, Crypto Currency, Mobile Payment, peer-to-peer lending, and digital payment wallets. Explore all fintech-related open-source software, libraries, packages, source code, cloud functions, and APIs.
Popular New Releases in Fintech
freqtrade
2022.3
truffle
v5.5.11 – Dubbel Zout Licorice 🧂
web3.js
Web3.js 1.3.1
metamask-extension
Version 10.13.0
lbry-sdk
v0.107.1
Popular Libraries in Fintech
by ccxt javascript
24082 MIT
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
by freqtrade python
17102 GPL-3.0
Free, open source crypto trading bot
by HelloZeroNet javascript
16995 NOASSERTION
ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
by bitcoinbook python
16943 NOASSERTION
Mastering Bitcoin 2nd Edition - Programming the Open Blockchain
by trufflesuite typescript
13000 MIT
A tool for developing smart contracts. Crafted with the finest cacaos.
by ethereumbook javascript
10272 NOASSERTION
Mastering Ethereum, by Andreas M. Antonopoulos, Gavin Wood
by ethereum javascript
9518 NOASSERTION
Ethereum JavaScript API
by MetaMask javascript
7807 NOASSERTION
:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
by ethereum javascript
7347 GPL-3.0
[DEPRECATED] Mist. Browse and use Ðapps on the Ethereum network.
Trending New libraries in Fintech
by ebellocchia python
133 MIT
Generation of mnemonics, seeds, private/public keys and addresses for different types of cryptocurrencies
by compound-developers javascript
98 MIT
Code examples for supplying Ethereum assets to the Compound Protocol.
by jacques-andre python
51 GPL-3.0
crypto-yank is a clipboard crypto stealer that monitors for crypto addresses and replaces them with your own.
by stripe javascript
39 MIT
Sample on-demand platform built on Stripe Connect: Custom Accounts and Connect Onboarding for deliveries. https://rocketdeliveries.io
by keep-network javascript
39 MIT
JS to access trustlessly tokenized threshold Bitcoin on Ethereum ;)
by invizi javascript
37 GPL-3.0
Invizi is a private cryptocurrency tracker. All your data is stored locally, encrypted and never leaves your computer. Invizi is 100% free.
by nanexcool javascript
35 CC0-1.0
Free translation strings for dapps and crypto wallets.
by loredanacirstea javascript
28 GPL-3.0
Measure twice, cut once. Lisp-like functional language for computable & immutable specifications, interpreted by WebAssembly & the Ethereum Virtual Machine.
by LimerBoy csharp
28 MIT
:moneybag: Replace any BTC, XMR, XLM, ETH, XRP, LTC, BCH, NEC, DASH, WMR, WMZ, WMH, WMU, QIWI, Yandex Money, Steam trade addresses in clipboard.
Top Authors in Fintech
1
7 Libraries
62
2
7 Libraries
114
3
7 Libraries
185
4
6 Libraries
71
5
4 Libraries
3163
6
4 Libraries
39
7
4 Libraries
40
8
4 Libraries
59
9
4 Libraries
33
10
4 Libraries
23
1
7 Libraries
62
2
7 Libraries
114
3
7 Libraries
185
4
6 Libraries
71
5
4 Libraries
3163
6
4 Libraries
39
7
4 Libraries
40
8
4 Libraries
59
9
4 Libraries
33
10
4 Libraries
23
Trending Kits in Fintech
Since 2019, retail trading has surged in the USA. With a combination of digital technology, access to financial advice (not guaranteed to be sound), reducing commissions, and folks confined at home with a pandemic, retail trading has been moving the markets.
This volatile combination has birthed a class of stocks called 'Meme Stocks'. Meme stocks don't go by the textbook classifications of growth or value stock. They are discussed heavily by retail investors on Reddit, Stocktwits, Twitter, and other channels. They are primarily overpriced, volatile and the valuation does not line up with the hype. Only the early adopters profit from these stocks. Stocks of GameStop, AMC, SPACs have followed this trend. Meme stocks have significantly impacted the markets to the extent that hedge funds see short selling as risky until the retail wave subsides. With the U.S. central counterparty clearinghouses raising margin requirements, the liquidity needs have imposed trading restrictions for individual investors.
Given the frenzy driven by digital technologies, there are over twenty thousand public libraries available for trading. kandi collection on Meme Stocks and Options Trading showcases public libraries that provide access to real-time and historical stock data, analytics solutions to understand trends and volatility, backtesting solutions to simulate trades, and full-fledged trading engines.
End-to-End Trading Engines
Lean by QuantConnect, StockSharp by StockSharp, and LiuAlgoTrader by amor71 are popular end-to-end trading engines and frameworks.
Stock Data Retrieval and Storage
ck by concurrencykit, FinMind by FinMind, redtide by qks1lver, and Python-NSE-Option-Chain-Analyzer by VarunS2002 enable you to access data from global exchanges and store them in high performance efficient concurrent data structures.
Financial and Mathematical Models
MachineLearningStocks by robertmartin8, finmath-lib by finmath and GraphVega by rahuljoshi44 enable you to try different financial and mathematical models on stocks to understand their technical valuation.
Simulation and Backtesting
optopsy by michaelchu, paperbroker by philipodonnell and TuringTrader by fbertram enable you to simulate and backtest trades.
ProPublica* reported that billionaires pay little in income tax compared to their massive wealth, sometimes, even nothing. Their records show that the wealthiest can legally pay income taxes amounting to a tiny fraction of the billions their fortunes grow each year. The median American household earned about $70,000 annually and paid about 14% in federal taxes. The highest income tax rate of 37% applies for couples on earnings above $628,300. However, the 25 wealthiest Americans paid a true tax rate of only 3.4%.
You will need sound financial advisors to achieve such tax rates. But as technologists, open source can help you in two remarkable ways. You can save significantly by using open source software, and you can use the below personal finance solutions to manage your wealth.
Personal finance helps individuals and families handle their financial management. Based on the spectrum of personal financial activities, this can span across banking products (checking, savings accounts, cards, wallets, and loans) or investments (shares, bonds, mutual funds) and insurance (life, health, disability) products or retirement plans, social security, and income tax management.
There are over 1,800 public libraries available for you to adopt personal finance solutions. kandi collection on Personal Finance Solutions showcases libraries across end-to-end personal finance management platforms, frameworks for creating your own accounting solution, simple budgeting solutions, and add-ons like mobile receipt scanners that make your life easier.
End-to-End Solutions
firefly-iii by firefly-iii, moneymanagerex by moneymanagerex and rotki by rotki are most popular end-to-end personal finance management solutions covering aspects across expenses, investments, banking, and others.
Foundational Framework
If you are looking for flexibility in creating your own solution income-expense by dbrax provides a foundational framework.
Simple Budgeting Functions
my-budget by reZach and budget by range-of-motion and provide simple budget and expense management functions.
Text and Spreadsheet Solutions
knut by sboehler and mintable by kevinschaich provide even simpler text-based or spreadsheet-based management.
Individual Functions
Try SmartReceiptsLibrary by SmartReceipts to scan your receipts.
A payment processing library can help make your eCommerce application-independent and well-equipped to handle multiple payment gateways. A PHP payment processing software enables multiple features like payment methods, secure authentication, integration with third-party software, etc. With this, you can add popular platforms like PayPal, Apple Pay, Google Pay, Stripe, UnionPay, and more to your web application. PHP allows developers to build fast and scalable applications that provide risk-free solutions to payment woes. With the help of these libraries, you can enable several online payment options like integration with the shopping cart, faster processing, multiple payment platforms, charge back prevention, fraud management, recurring billing, etc.
Below are our 20 best PHP payment processing open source libraries in 2021. Omnipay is a framework agnostic, multi-gateway payment processing library built for PHP 5.6+. Its consistent API is fully unit tested and comes with an example application for beginners. Here, you can learn an API and use it in multiple projects without rewriting the code. Another library, InvoicePlane is a self-hosted open-source application that manages invoices, clients, and payments. Payum Bundle, on the other hand, is an MIT-licensed open-source project that offers all payment-related solutions. It supports both simple use cases as well as very advanced ones.
All new-age finance professionals committed to data analysis and data science are dependent on Python at some level. It is with Python that they can perform analysis on various financial data points. But Python turns out to be a formidable tool even while developing personal finance applications. For instance, you can scrape the web for personal finance data, download financial transactions, develop a budget tracking app, and so on, all with Python.
With that in mind, let’s have a quick overview of some of the best open-source Python packages and libraries for personal finance. Ofxstatement is a tool developed with the intention to convert proprietary bank statements to OFX format which is the accepted format for major personal accounting systems. One of the best open-source Python packages, finance-dl is used for scraping personal finance data from various financial institutions. It performs best when used with beancount-import which is a tool for semi-automatic data importing. We also have MyMoney, which is essentially a web application for personal finance built with Django. It can manage your bank account, your transactions, analyze them and schedule them if they’re recurrent. MyMoney a simple tool with the goal to analyze your expenses.
this one helps with Spring Framework building and deploy web applications easily updated
this is para2
this is para3
Development Environment
In August 2021, the U.S. Department of Justice repatriated an additional $452 million in 1MDB funds to Malaysia. This repatriation took the total amount recovered from the corruption scandal to $1.2 billion. The funds had been laundered through major financial institutions worldwide, including in the United States, Switzerland, Singapore, and Luxembourg.
While there are multiple global regulations targeting money laundering, multiple estimates peg the size of money laundering between $800 billion to $2 trillion annually. While there are multiple commercially available AML packages, the core technologies are the ability to stream-process vast sources of information and intelligent algorithms to identify money laundering patterns.
kandi collection on Anti-Money Laundering covers open source libraries across data scraping, stream processing, open source intelligence (OSINT Framework), anti-money laundering algorithms, and case management for anti-money laundering.
Scraping and Stream Processing
Key inputs for an AML solution are processing a variety of sources of information. Web scraping and real time streaming solutions help achieve this. For more insights on streaming refer to the kandi kit - Building a Stream Processing Application using open source libraries . For more insights on web scraping refer to the kandi collection - 13 best Python Web Scraping libraries in 2021.
Open Source Intelligence
A variety of open source intelligence tools enable targeting information gathering from multiple sources.
Anti-Money Laundering Algoritms
AML algorithms are key in identifying fraud patterns and flagging them.
Case Management for Anti-Money Laundering
Case management libraries process the alerts raised by the AML algorithms. Below are libraries spanning across general process management to ones tailored to legal and fraud management.
Binance operates the world's biggest bitcoin exchange and altcoin crypto exchange in the world by volume. The Financial Conduct Authority (FCA) has ruled that the firm cannot conduct any "regulated activity" in the UK. It also issued a consumer warning about Binance.com, advising people to be wary of adverts promising high returns on crypto-asset investments. The US Securities and Exchange Commission (SEC) and Japan's Financial Services Agency (FSA) had also issued warnings about Binance.
Crypto exchanges allow customers to trade cryptocurrencies with other assets, such as money or other digital currencies. Exchanges may accept credit card payments, wire transfers, or other forms of charge in exchange for cryptocurrencies. The exchanges can send cryptocurrency to a user's wallet or convert digital currency balances into prepaid cards to withdraw funds from ATMs worldwide. In contrast, other digital currencies are backed by real-world commodities such as gold. The regulation of crypto exchanges differs from country to country.
While Binance is a market leader, there are multiple other crypto exchanges. kandi collection on Binance Alternatives lists accelerators across other popular exchanges such as Robinhood Crypto, Coinbase, Poloniex, Uphold, and Kraken. Do not construe this as financial or legal advice.
Robinhood Crypto Libraries
robin_stocks by jmfernandes, robinhood-crypto by wang-ye, and robinhood-observer by jspenc72 enable integration with Robinhood Crypto.
Coinbase Libraries
optimal-buy-cbpro by brndnmtthws, coinbase-exchange-order-book by PierreRochard, and open-source-coinbase-index-fund by acmeyer are popular Coinbase focused libraries.
Poloniex Libraries
If you are looking to leverage Poloniex, try MikaLendingBot by BitBotFactory, python-poloniex by s4w3d0ff, and Personal - Poloniex Trading Bot by dalton_baker.
Uphold Libraries
uphold-sdk-javascript by uphold, uphold-sdk-python by byrnereese, uphold-sdk-android by uphold, and uphold-sdk-ios by uphold enable you to trade on Uphold.
Kraken Libraries
Alternatively, aio-kraken-ws by cdlr75, Telegram-Kraken-Bot by Endogen, kraken-go-api-client by beldur, and npm-kraken-api by nothingisdead allow you to trade on Kraken.
Cryptocurrencies ushered in an era of digital assets that eased the medium of exchange while ensuring secure transaction records. As a result, the entire supply chain of creation and transfer is transparent, secure, and verifiable, making cryptocurrencies a mainstay in Fintech. Bitcoin was released in 2009 as an open source software and a decentralized cryptocurrency. Following Bitcoin, multiple cryptocurrencies have been created with Bitcoin and Ethereum holding market leadership. In April 2021, the total market cap of cryptocurrencies surpassed the USD two trillion mark.
Cryptocurrencies bring transparency and speed. However, the lack of sovereign guarantees and central banking regulation has raised multiple governance issues. For example, the legality and taxation of cryptocurrencies vary by country and are still evolving. In addition, cryptocurrencies have been the target of speculation, fraud, theft, and darknet transactions that highlight the lack of central regulating authorities.
Multiple factors impact the value of cryptocurrencies. The most famous factor in recent times is Elon Musk. While actions of leaders of states impacted their economies, cryptocurrencies are open to influence from nonstate actors. Elon Musk's Tesla announced it would buy $1.5 billion worth of bitcoin and said it would accept the virtual currency as payment for its electric cars. However, a few months later, Musk tweeted on the nonsustainable energy consumption of cryptocurrencies, knocking off their value. He increased the value of Dogecoin through his tweets. While there are more significant issues facing cryptocurrencies, Musk's tweets are probably the most visible ones, and accusations range from speculation to conflict of interest.
kandi collection on Elon Musk Crypto Tweet Trackers provides you with public libraries that you can try for free and provide you functions to automate trades, review the impact of cryptocurrencies based on his tweets, and some other fun projects. Do not construe this as financial or legal advice.
Compare Prices
elon_doge_tracker by rodgerbenham and TLSA-vs-Elon-s-Tweets by Joerg-ffs compare Elon Musk's tweets to the Tesla stock price and Dogecoin.
Trading Bots
bitcoin-bot-buy-if-elon-tweets by CyberPunkMetalHead, elonbot by vslaykovsky, tradoge by gschurck, Twitter_Activated_Crypto_Trading_Bot by jaimindp, moon-doge by antoinebaron-io and Elon-Alert by oguzdelioglu are automated trading bots that help you trade cryptocurrencies based on his tweets.
Fun Projects
Finally, if you care less for cryptocurrencies and are just looking for fun, RandomElon by thecookiemonsters and elon-bot by Macr0Nerd help produce random Elon Musk quotes.
Did you know Bitcoin consumes more electricity than the whole country of Sweden? Bitcoin compares to over 10 times the global solar and wind energy produced. On a global scale, Bitcoin uses 0.66% of all electricity consumed worldwide. That is huge for a new-age digital currency!
The core issue in cryptocurrencies has been mining. Most cryptocurrencies rely on a computational competition called Proof of Work (PoW). In this model, participants are rewarded with cryptocoins for adding transactions to the blockchainÆs globally distributed ledger. More computational capability means a higher chance to earn more cryptocoins. Application-specific ICs (ASICs) that accelerate mining, concentrated power over many cryptocurrencies. EthereumÆs ether-mining algorithm penalizes the use of ASICs.
However, turning towards energy-efficient approaches, proof of stake (PoS) is a credible alternative to the PoW approach. Replacing the concept of all processors processing duplicate transactions, PoS randomly picks one to do the job to make this efficient. The validatorÆs stake or collateral ensures the authenticity of the validation.
kandi collection on Sustainable Cryptocurrencies, lists energy efficient cryptocurrency libraries for you to try. Each may follow different approaches to improve sustainability over Bitcoin.
For other cryptocurrencies or specific implementations, search on kandi.
Source credit for Bitcoin energy comparisons: https://cbeci.org/cbeci/comparisons
Proof of Stake Approach
eos by EOSIO, go-algorand by algorand, cardano-node-docker by abracadaniel, and metahash-fullnode-client by metahashorg are popular cyptocurrencies leveraging the Proof of Stake approach.
Block Lattice Technology
nano-node by nanocurrency leverages energy efficient Block Lattice Technology.
Stellar Consensus Protocol
stellar-core by stellar supports traditional currencies and leverages its proprietary Stellar Consensus Protocol that is efficient.
HoloTokens
holochain by holochain brings in a unique no mining approach using HoloTokens that makes it inherently energy efficient.
Proof of Capacity
burstcoin-jminer by de-luxe leverages the Proof of Capacity approach.
Energy Incentives
SolarCoin-Raspberry-Pi-Node by Scalextrix incentivizes Solar Energy production and hedera-services by hashgraph leverages the Power Transition tool to drive energy efficiency.
Cryptocurrency wallets are software programs that store your public and private keys and interface with various blockchain so users can monitor their balance, send money and conduct other operations. If you want to use Bitcoin or any other cryptocurrency, you will need to have a digital wallet. A cryptocurrency wallet is a software program designed to store your public and private keys, send and receive digital currencies, monitor their balance, and interact with various blockchains. You need to have a cryptocurrency wallet. The following libraries can be used to generate and manage keys, create wallets, sign transactions and broadcast them to the network among other functionalities.. The best JavaScript Cryptocurrency Wallet libraries in 2022:WalletConnect - A standard for connecting to web wallets using a QR Code; Uport - Self sovereign identity platform; Universal Login SDK - A complete identity and wallet system for Ethereum; Ethers.js - An open source library for building dapps on Ethereum.
If you're new to DeFi, here's a quick primer: DeFi is short for decentralized finance. It's a way for businesses to leverage the benefits of blockchain technology without having to sacrifice the security, speed, and scale of existing financial services solutions. The last couple of years have been huge for decentralized (DeFi) projects, and it's only going to get bigger. With the growing interest in smart contracts, crypto assets, and the wider benefits of decentralized exchange services, companies have already invested heavily into the future of decentralized finance. Now, we're reaching a point where DeFi is no longer a corner case niche; the average person is more educated in the use of wallets and private keys, as well as the wider benefits of decentralized currency. So what does this mean for you? Well, if you want to stay up to date on all things DeFi then you're going to need some resources to help you get started. Luckily I've put together reusable opensource libraries that you can use with top DeFi such as Terra LUNA, Avalanche, Dai, ChainLink, Uniswap, Fantom, Theta Network, THORChain, Tezos and others.
Build high quality encrypted wallets with other incredible features for your Bitcoin. Get ratings, code snippets & documentation for each library.
Build wallets, mine coins, integrate with crypto exchanges, trading bots, and more for Ethereum .Get ratings, code snippets & documentation for each library.
Trending Discussions on Fintech
postgres: LEFT JOIN table and field does not exist
Webpage starts zoomed out on mobile devices
Not able to render axios's response with map
JSON html string to a new page
Django render many to many attributes after query, display None
Python web scraper, with BeautifulSoup I am having problem with my link , the link is now going to headline story but redirecting to the archives page
Trying to get property 'title' of non-object Curl PHP
Using float left and right/ width 50% is not allowing my content to be responsive on mobile view
How can I solve the npm run dev error I'm facing after creating a new Laravel 7 project?
getting error when trying to convert object column into int
QUESTION
postgres: LEFT JOIN table and field does not exist
Asked 2022-Apr-15 at 08:16This is my query
1SELECT org.id,
2 org.name,
3 org.type,
4 org.company_logo,
5 (SELECT org_profile.logo_url FROM org_profile WHERE org_profile.org_id = org.id AND org_profile.status = 'active' ORDER BY org_profile.id DESC LIMIT 1) as logo_url,
6 org.short_description,
7 org_profile.value_prop,
8 count(*) OVER () AS total
9 FROM org
10 LEFT JOIN user_info ON user_info.id = org.approved_by
11 INNER JOIN (select distinct org_profile.org_id from org_profile) org_profile ON org_profile.org_id = org.id
12 WHERE
13 org.type = 'Fintech'
14 AND org.status = 'APPROVED'
15 AND org.draft != TRUE
16 ORDER BY org.id DESC
17
18
I am using LEFT JOIN
query with my org_profile
table. I used distinct
for unique org id but the problem is org_profile.value_prop
column does not work. The error is showing column org_profile.value_prop does not exist
I'm trying to solve this issue. But I don't figure out this issue.
ANSWER
Answered 2022-Apr-15 at 07:22basically, the error informs that you try to get the value_prop
field from org_profile
subquery, which basically doesn't exist.
It's difficult to give a working query by writting just on the paper, but I think that:
- it's worth to apply the handy
aliasses
for each subquery - deduplication, if required, should be done in the subquery. When multiple fields used DISTINCT may be insufficient - RANK function may be required.
- you make some operations to get the
logo_url
by a scalar subquery - it seems a bit strange, especially the same table is used in JOIN - I would suggest to move all logic related toorg_profile
to the subquery. Scalar expressions would throw an error in case multiple values would be found in output.
1SELECT org.id,
2 org.name,
3 org.type,
4 org.company_logo,
5 (SELECT org_profile.logo_url FROM org_profile WHERE org_profile.org_id = org.id AND org_profile.status = 'active' ORDER BY org_profile.id DESC LIMIT 1) as logo_url,
6 org.short_description,
7 org_profile.value_prop,
8 count(*) OVER () AS total
9 FROM org
10 LEFT JOIN user_info ON user_info.id = org.approved_by
11 INNER JOIN (select distinct org_profile.org_id from org_profile) org_profile ON org_profile.org_id = org.id
12 WHERE
13 org.type = 'Fintech'
14 AND org.status = 'APPROVED'
15 AND org.draft != TRUE
16 ORDER BY org.id DESC
17
18SELECT
19 org.id,
20 org.name,
21 org.type,
22 org.company_logo,
23 prof.logo_url,
24 org.short_description,
25 prof.value_prop,
26 count(*) OVER () AS total
27FROM org
28JOIN (
29 select distinct org_id, logo_url, value_prop -- other deduplication type (RANK) may be required
30 from org_profile
31 where status = 'active' -- ?
32) prof ON org.id = prof.org_id
33LEFT JOIN user_info usr ON usr.id = org.approved_by
34WHERE
35 org.type = 'Fintech'
36 AND org.status = 'APPROVED'
37 AND org.draft != TRUE
38ORDER BY org.id DESC
39
QUESTION
Webpage starts zoomed out on mobile devices
Asked 2022-Jan-15 at 20:33I have created a website for desktop and mobile, and it has to be responsive. My problem is that when I resize the browser all the content gets zoomed out instead of adapting. I also have an issue with the HTML. why is it only taking up 1/3 of the page according to dev tools and when I add width:1100px
to my sections it renders the desktop version, but when I take it away it floats to the left side? Why is this happening?
Images of the problem:
1* {
2 margin: 0;
3 padding: 0;
4 box-sizing: border-box;
5}
6 body {
7 font-family: 'Source Sans Pro', sans-serif;
8 background-color: black;
9 color: white;
10 line-height: 30px;
11}
12 html {
13 width:100%;
14}
15 img {
16 width: 100%;
17}
18 h1 {
19 font-weight: 700;
20 font-size: 44px;
21 margin-bottom: 40px;
22 line-height: 50px;
23}
24 h3 {
25 width: 100%;
26}
27/* header */
28 header {
29 display: flex;
30 background-color: black;
31 height: 80px;
32 min-width: 1100px;
33 justify-content: right;
34 align-items: center;
35 margin-bottom: 50px;
36 border-bottom: 1px solid white;
37}
38 nav ul li {
39 display: inline-block;
40 list-style-type: none;
41 margin-right: 20px;
42}
43 .nav-links{
44 color: white;
45 font-size: 18px;
46}
47/* Banner */
48 .banner {
49 display: flex;
50 justify-content: space-around;
51 align-items: center;
52 min-height: 500px;
53 width: 100%;
54}
55 .banner-text-container {
56 max-width: 30%;
57 font-size: 22px;
58}
59 span {
60 color: #11cc9e;
61}
62 .consultation-link{
63 color: #11cc9e;
64 text-decoration: none;
65 margin-top: 30px;
66 font-weight: 900;
67 display: block;
68 border: 1px solid white;
69 max-width: 40%;
70 text-align: center;
71 padding: 5px;
72}
73 .consultation-link:hover{
74 background-color: #fff;
75}
76/* About */
77 .about {
78 display: flex;
79 justify-content: space-around;
80 align-items: center;
81 min-height: 600px;
82 min-width: 1100px;
83}
84 .about-text-container {
85 max-width: 40%;
86 font-size: 22px;
87 margin-left: 20px;
88}
89 .about-img{
90 width: 400px;
91 margin-right: 22px;
92}
93 .about-title {
94 margin-bottom: 40px;
95}
96 .about-us-link{
97 color: #11cc9e;
98 text-decoration: none;
99 margin-top: 30px;
100 font-weight: 900;
101 display: block;
102 border: 1px solid white;
103 text-align: center;
104 max-width: 25%;
105 padding: 5px;
106}
107 .about-us-link:hover{
108 background-color: #fff;
109}
110/* Join */
111 .join {
112 min-height: 600px;
113 min-width: 1100px;
114 max-width: 100%;
115}
116 .join-header{
117 width: 100%;
118 text-align: center;
119 margin-top: 150px;
120 font-size: 40px;
121}
122 .container-boxes{
123 position: relative;
124 top: 0;
125 bottom: 0;
126 display: flex;
127 flex-wrap: wrap;
128 justify-content: space-evenly;
129 align-items: center;
130 min-height: 500px;
131 min-width: 1100px;
132}
133 .box {
134 position: relative;
135 overflow: hidden;
136 transition: 0.5s;
137 height: 200px;
138 width: 300px;
139}
140 .box:hover{
141 z-index: 1;
142 transform: scale(1.25);
143 box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
144 cursor: pointer;
145}
146 .box .imgBX{
147 position: absolute;
148 top: 0;
149 left: 0;
150 width: 100%;
151 height: 100%;
152}
153 .box .imgBX img{
154 position: absolute;
155 top: 0;
156 left: 0;
157 width: 100%;
158 height: 100%;
159 object-fit: cover;
160}
161 .box .imgBX:before{
162 content: '';
163 position: absolute;
164 top: 0;
165 left: 0;
166 width: 100%;
167 height: 100%;
168 z-index: 1;
169 background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
170 mix-blend-mode: multiply;
171 opacity: 0;
172 transition: 0.5s;
173}
174 .box:hover .imgBX:before {
175 opacity: 1;
176}
177 .box .imgBX img{
178 position: absolute;
179 top: 0;
180 left: 0;
181 width: 100%;
182 height: 100%;
183 object-fit: cover;
184}
185 .content{
186 display: flex;
187 flex-direction: column;
188 text-align: center;
189 position: absolute;
190 top: 20%;
191 bottom: 40%;
192 width: 100%;
193 height: 100%;
194 z-index: 1;
195 padding: 20px;
196 visibility: hidden;
197}
198 .box:hover .content{
199 visibility: visible;
200}
201/* Quote section */
202 .quote-section {
203 display: flex;
204 justify-content: center;
205 max-width: 100%;
206 min-height: 500px;
207 min-width: 1100px;
208}
209 .quote-container {
210 display: flex;
211 flex-direction: column;
212 flex-wrap: wrap;
213 align-items: center;
214 justify-items: center;
215 max-width: 50%;
216 font-size: 22px;
217 text-align: center;
218}
219 .quote {
220 line-height: 90px;
221 font-size: 150px;
222 font-style: italic;
223 color: #11cc9e;
224 text-indent: -37px;
225 font-weight: 600;
226 width: 37px;
227}
228 .quote-img{
229 width: 90px;
230 margin: 40px auto;
231}
232 .person-name{
233 color: #ccc;
234}
235 .person-role{
236 font-size: 17px;
237 color: #ccc;
238}
239/* Footer */
240 footer {
241 text-align: center;
242 margin-top: 100px;
243 padding-top: 50px;
244 max-width: 100%;
245 min-height: 200px;
246 min-width: 1100px;
247 border-top: 1px solid #fff;
248}
1* {
2 margin: 0;
3 padding: 0;
4 box-sizing: border-box;
5}
6 body {
7 font-family: 'Source Sans Pro', sans-serif;
8 background-color: black;
9 color: white;
10 line-height: 30px;
11}
12 html {
13 width:100%;
14}
15 img {
16 width: 100%;
17}
18 h1 {
19 font-weight: 700;
20 font-size: 44px;
21 margin-bottom: 40px;
22 line-height: 50px;
23}
24 h3 {
25 width: 100%;
26}
27/* header */
28 header {
29 display: flex;
30 background-color: black;
31 height: 80px;
32 min-width: 1100px;
33 justify-content: right;
34 align-items: center;
35 margin-bottom: 50px;
36 border-bottom: 1px solid white;
37}
38 nav ul li {
39 display: inline-block;
40 list-style-type: none;
41 margin-right: 20px;
42}
43 .nav-links{
44 color: white;
45 font-size: 18px;
46}
47/* Banner */
48 .banner {
49 display: flex;
50 justify-content: space-around;
51 align-items: center;
52 min-height: 500px;
53 width: 100%;
54}
55 .banner-text-container {
56 max-width: 30%;
57 font-size: 22px;
58}
59 span {
60 color: #11cc9e;
61}
62 .consultation-link{
63 color: #11cc9e;
64 text-decoration: none;
65 margin-top: 30px;
66 font-weight: 900;
67 display: block;
68 border: 1px solid white;
69 max-width: 40%;
70 text-align: center;
71 padding: 5px;
72}
73 .consultation-link:hover{
74 background-color: #fff;
75}
76/* About */
77 .about {
78 display: flex;
79 justify-content: space-around;
80 align-items: center;
81 min-height: 600px;
82 min-width: 1100px;
83}
84 .about-text-container {
85 max-width: 40%;
86 font-size: 22px;
87 margin-left: 20px;
88}
89 .about-img{
90 width: 400px;
91 margin-right: 22px;
92}
93 .about-title {
94 margin-bottom: 40px;
95}
96 .about-us-link{
97 color: #11cc9e;
98 text-decoration: none;
99 margin-top: 30px;
100 font-weight: 900;
101 display: block;
102 border: 1px solid white;
103 text-align: center;
104 max-width: 25%;
105 padding: 5px;
106}
107 .about-us-link:hover{
108 background-color: #fff;
109}
110/* Join */
111 .join {
112 min-height: 600px;
113 min-width: 1100px;
114 max-width: 100%;
115}
116 .join-header{
117 width: 100%;
118 text-align: center;
119 margin-top: 150px;
120 font-size: 40px;
121}
122 .container-boxes{
123 position: relative;
124 top: 0;
125 bottom: 0;
126 display: flex;
127 flex-wrap: wrap;
128 justify-content: space-evenly;
129 align-items: center;
130 min-height: 500px;
131 min-width: 1100px;
132}
133 .box {
134 position: relative;
135 overflow: hidden;
136 transition: 0.5s;
137 height: 200px;
138 width: 300px;
139}
140 .box:hover{
141 z-index: 1;
142 transform: scale(1.25);
143 box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
144 cursor: pointer;
145}
146 .box .imgBX{
147 position: absolute;
148 top: 0;
149 left: 0;
150 width: 100%;
151 height: 100%;
152}
153 .box .imgBX img{
154 position: absolute;
155 top: 0;
156 left: 0;
157 width: 100%;
158 height: 100%;
159 object-fit: cover;
160}
161 .box .imgBX:before{
162 content: '';
163 position: absolute;
164 top: 0;
165 left: 0;
166 width: 100%;
167 height: 100%;
168 z-index: 1;
169 background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
170 mix-blend-mode: multiply;
171 opacity: 0;
172 transition: 0.5s;
173}
174 .box:hover .imgBX:before {
175 opacity: 1;
176}
177 .box .imgBX img{
178 position: absolute;
179 top: 0;
180 left: 0;
181 width: 100%;
182 height: 100%;
183 object-fit: cover;
184}
185 .content{
186 display: flex;
187 flex-direction: column;
188 text-align: center;
189 position: absolute;
190 top: 20%;
191 bottom: 40%;
192 width: 100%;
193 height: 100%;
194 z-index: 1;
195 padding: 20px;
196 visibility: hidden;
197}
198 .box:hover .content{
199 visibility: visible;
200}
201/* Quote section */
202 .quote-section {
203 display: flex;
204 justify-content: center;
205 max-width: 100%;
206 min-height: 500px;
207 min-width: 1100px;
208}
209 .quote-container {
210 display: flex;
211 flex-direction: column;
212 flex-wrap: wrap;
213 align-items: center;
214 justify-items: center;
215 max-width: 50%;
216 font-size: 22px;
217 text-align: center;
218}
219 .quote {
220 line-height: 90px;
221 font-size: 150px;
222 font-style: italic;
223 color: #11cc9e;
224 text-indent: -37px;
225 font-weight: 600;
226 width: 37px;
227}
228 .quote-img{
229 width: 90px;
230 margin: 40px auto;
231}
232 .person-name{
233 color: #ccc;
234}
235 .person-role{
236 font-size: 17px;
237 color: #ccc;
238}
239/* Footer */
240 footer {
241 text-align: center;
242 margin-top: 100px;
243 padding-top: 50px;
244 max-width: 100%;
245 min-height: 200px;
246 min-width: 1100px;
247 border-top: 1px solid #fff;
248}<!DOCTYPE html>
249<html lang="en">
250 <head>
251 <title>Codes</title>
252 <link rel="preconnect" href="https://fonts.googleapis.com">
253 <ink rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
254 <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap" rel="stylesheet">
255 <meta charset="UTF-8">
256 <meta http-equiv="X-UA-Compatible" content="IE=edge">
257 <meta name="viewport" content="width=device-width, initial-scale=1">
258 <link rel="stylesheet" href="./Resources/styles.css">
259 </head>
260 <body>
261 <header>
262 <!-- insert logo -->
263 <nav class="nav-links">
264 <ul>
265 <li>About</li>
266 <li>Peer group</li>
267 <li>Review</li>
268 </ul>
269 </nav>
270 </header>
271 <section class="banner">
272 <div class="banner-text-container">
273 <h1>Build. Grow. <span class="color-Learn">Learn.</span></h1>
274 <p>Unlock your potential with your peers!, using Blockchain, Fintech or the IT outsourcing company Boosty Labs helps you create an innovative end to end product or augment your team with the right experts.</p>
275 <a class="consultation-link" href="#">Free consultation </a>
276 </div>
277 <div class="banner-img">
278 <img src="./Resources/Images/banner.png" alt="">
279 </div>
280 </section>
281 <section class="about">
282 <div class="about-text-container">
283 <h2 class="about-title">Who we are</h2>
284 <p>Here you can find our ,collection of coding, data science and statistics tutorials with examples in R, Python, JavaScript and Python. As you click through, you'll notice that some tutorials have ribbons on their logos - they are part of our free and self-paced online course Data Science for Ecologists and Environmental Scientists! Yellow for the Stats from Scratch stream, blue for Wiz of Data Viz and purple for Mastering Modelling.</p>
285 <a class="about-us-link" href="#">More about us </a>
286 </div>
287 <div class="about-img">
288 <img src="./Resources/Images/whoweare.png" alt="">
289 </div>
290 </section>
291 <section class="join">
292 <h3 class="join-header" >Join a peer group!</h3>
293 <div class="container-boxes">
294 <div class="box">
295 <div class="imgBX">
296 <img src="./Resources/Images/box-1.png" alt="">
297 </div>
298 <div class="content">
299 <h3>AI</h3>
300 <P>Discover The Complete Range Of Artificial Intelligence Solutions.</P>
301 </div>
302 </div>
303 <div class="box">
304 <div class="imgBX">
305 <img src="./Resources/Images/box-2.png" alt="">
306 </div>
307 <div class="content">
308 <h3 class="frontend-title">Frontend Dev</h3>
309 <p>Discover The Complete Range Of Frontend Solutions.</p>
310 </div>
311 </div>
312 <div class="box">
313 <div class="imgBX">
314 <img src="./Resources/Images/box-3.png" alt="">
315 </div>
316 <div class="content">
317 <h3>Microsoft systems</h3>
318 <p>Discover The Complete Range Of Microsoft Solutions.</p>
319 </div>
320 </div>
321 </div>
322 </section>
323 <section class="quote-section">
324 <div class="quote-container">
325 <div class="quote">"</div>
326 <p class="p-quote">In coded, the progress of the topics and the exercises are really good. It's so nice to practice on good story told tasks. Also if you are stuck, it is nice to have a broad range of coders around in the peer groups that you can get the answers you are looking for.</p>
327 <div class="quote-img">
328 <img src="./Resources/Images/person-img.png" alt="">
329 </div>
330 <div class="person-name">Peter Gangland </div>
331 <div class="person-role">Director of business dev at <span>Microsoft</span></div>
332 </div>
333 </section>
334 <footer>
335 <div id="contact">
336 <h2>
337 Contact us</h5>
338 <h5>coded@peers.com</h5>
339 <h5>831-867-5309</h5>
340 </div>
341 <div id="copyright">
342 <h5>@copyright coded Enterprises 2022</h5>
343 </div>
344 </footer>
345 </body>
346</html>
ANSWER
Answered 2022-Jan-15 at 19:43For making your website responsive you need to use media queries. It's like you tell the browser how to style your website in different sizes. I think your problem with your sections might also get solved if you try to make your website responsive.
QUESTION
Not able to render axios's response with map
Asked 2021-Nov-23 at 23:44I am facing an issue rendering axios get response response in my react component. I can see that my get request is successfull and that data is retrieved from my backend however when rendering I get this error :
1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4 27 |
5 28 | return (
6 29 | <div className="card list">
7> 30 | <Grid container spacing={4}>
8 | ^ 31 | {startup.map((startups) => (
9 32 | <Grid key={startups.id} item xs={4}>
10 33 | <Link to={{ pathname: `product/${startups.id}` }}>
11
Here is my code :
1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4 27 |
5 28 | return (
6 29 | <div className="card list">
7> 30 | <Grid container spacing={4}>
8 | ^ 31 | {startup.map((startups) => (
9 32 | <Grid key={startups.id} item xs={4}>
10 33 | <Link to={{ pathname: `product/${startups.id}` }}>
11import React from 'react';
12import CardComponent from './CardComponent';
13import { Grid } from '@material-ui/core';
14import { Link } from 'react-router-dom';
15import { useState, useEffect } from 'react';
16import StartUpService from './../Services/StartUpService';
17
18const CardList = () => {
19 const [startup, setstartups] = useState([]);
20
21
22 useEffect(() => {
23 retrieveTutorials();
24 }, []);
25
26 const retrieveTutorials = () => {
27 StartUpService.getAll()
28 .then((response) => {
29 const myData = response.data;
30 setstartups(myData);
31 console.log(myData);
32 })
33 .catch((e) => {
34 console.log(e);
35 });
36 };
37
38 return (
39 <div className="card list">
40 <Grid container spacing={4}>
41 {startup.map((startups) => (
42 <Grid key={startups.id} item xs={4}>
43 <Link to={{ pathname: `product/${startups.id}` }}>
44 <CardComponent
45 className="cards"
46 key={startups.id}
47 id={startups.id}
48 image={startups.image}
49 header={startups.header}
50 title={startups.title}
51 category={startups.category}
52 summary={startups.summary}
53 />
54 </Link>
55 </Grid>
56 ))}
57 </Grid>
58 </div>
59 );
60};
61
62export default CardList;
63
I am not sure what's wrong with my map function?
Here is first object of my API response :
1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4 27 |
5 28 | return (
6 29 | <div className="card list">
7> 30 | <Grid container spacing={4}>
8 | ^ 31 | {startup.map((startups) => (
9 32 | <Grid key={startups.id} item xs={4}>
10 33 | <Link to={{ pathname: `product/${startups.id}` }}>
11import React from 'react';
12import CardComponent from './CardComponent';
13import { Grid } from '@material-ui/core';
14import { Link } from 'react-router-dom';
15import { useState, useEffect } from 'react';
16import StartUpService from './../Services/StartUpService';
17
18const CardList = () => {
19 const [startup, setstartups] = useState([]);
20
21
22 useEffect(() => {
23 retrieveTutorials();
24 }, []);
25
26 const retrieveTutorials = () => {
27 StartUpService.getAll()
28 .then((response) => {
29 const myData = response.data;
30 setstartups(myData);
31 console.log(myData);
32 })
33 .catch((e) => {
34 console.log(e);
35 });
36 };
37
38 return (
39 <div className="card list">
40 <Grid container spacing={4}>
41 {startup.map((startups) => (
42 <Grid key={startups.id} item xs={4}>
43 <Link to={{ pathname: `product/${startups.id}` }}>
44 <CardComponent
45 className="cards"
46 key={startups.id}
47 id={startups.id}
48 image={startups.image}
49 header={startups.header}
50 title={startups.title}
51 category={startups.category}
52 summary={startups.summary}
53 />
54 </Link>
55 </Grid>
56 ))}
57 </Grid>
58 </div>
59 );
60};
61
62export default CardList;
63{"data":[{"id":1,"header":"First Start Up Header","title":"Title for
64Startup 1","category":"First Start Up Category","description":"First
65Start Up description","tags":
66
67["FINTECH"],"card_image":"http://localhost:8000/media/card_images/card1.jpg","logo_image":"http://localhost:8000/media/logo_images/1.png"},
68
69
ANSWER
Answered 2021-Nov-23 at 23:35Nothing is wrong with map. startup
isn't an array (or other type supporting .map). console.log
the api response and you'll see what it really is.
You're code is probably fine the API is just returning data in a format other than what you expect.
QUESTION
JSON html string to a new page
Asked 2021-Oct-31 at 13:45Good afternoon Folks,
I have a JSON file from an API where articles are stored in a long string formatted with HTML format, how can I open them on a new page? If I insert this into a file with an HTML extension then I got a nicely formatted webpage. The data comes as "items" property as a list and I try to get them linkable like this, where the articles are under details_en
1 `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&type=5`
2
3 <div id="article">{{item.details_en}}</div>
4
the actual JSON string looks like this but much longer:
<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US"> </span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US"> </span></p>
ANSWER
Answered 2021-Oct-31 at 13:45Try with v-html directive:
1 `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&type=5`
2
3 <div id="article">{{item.details_en}}</div>
4new Vue({
5 el: '#demo',
6 data() {
7 return {
8 items: [{details_en:'<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p>'}, {details_en:'<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p>'}]
9 }
10 }
11})
12
13Vue.config.productionTip = false
14Vue.config.devtools = false
1 `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&type=5`
2
3 <div id="article">{{item.details_en}}</div>
4new Vue({
5 el: '#demo',
6 data() {
7 return {
8 items: [{details_en:'<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p>'}, {details_en:'<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p>'}]
9 }
10 }
11})
12
13Vue.config.productionTip = false
14Vue.config.devtools = false<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
15<div id="demo">
16 <div v-for="(item, idx) in items" :key="idx" id="article" v-html="item.details_en"></div>
17</div>
QUESTION
Django render many to many attributes after query, display None
Asked 2021-Aug-11 at 14:23I am using slug to query the model, and render result in HTML. The code is unable to render actual name of region, it just return None
Model
1class Region(models.Model):
2 name = models.CharField(blank=False, unique=True)
3 def __str__(self):
4 return self.name
5
6class Theme(models.Model):
7 name = models.CharField(blank=False, unique=True)
8 slug = models.SlugField(default="", null=False)
9 def __str__(self):
10 return self.name
11
12class ETF(models.Model):
13 ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True)
14 full_name = models.CharField(max_length=200, blank=False)
15 # many to many
16 region = models.ManyToManyField(Region)
17 theme = models.ManyToManyField(Theme)
18
views.py
1class Region(models.Model):
2 name = models.CharField(blank=False, unique=True)
3 def __str__(self):
4 return self.name
5
6class Theme(models.Model):
7 name = models.CharField(blank=False, unique=True)
8 slug = models.SlugField(default="", null=False)
9 def __str__(self):
10 return self.name
11
12class ETF(models.Model):
13 ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True)
14 full_name = models.CharField(max_length=200, blank=False)
15 # many to many
16 region = models.ManyToManyField(Region)
17 theme = models.ManyToManyField(Theme)
18def theme_etf(request, slug): # render ETFs with theme filter
19 filtered_results = ETF.objects.filter(theme__slug=slug)
20 return render(request, "etf/list_etf.html", {
21 "ETFs": filtered_results
22 })
23
Part of list_etf.html
1class Region(models.Model):
2 name = models.CharField(blank=False, unique=True)
3 def __str__(self):
4 return self.name
5
6class Theme(models.Model):
7 name = models.CharField(blank=False, unique=True)
8 slug = models.SlugField(default="", null=False)
9 def __str__(self):
10 return self.name
11
12class ETF(models.Model):
13 ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True)
14 full_name = models.CharField(max_length=200, blank=False)
15 # many to many
16 region = models.ManyToManyField(Region)
17 theme = models.ManyToManyField(Theme)
18def theme_etf(request, slug): # render ETFs with theme filter
19 filtered_results = ETF.objects.filter(theme__slug=slug)
20 return render(request, "etf/list_etf.html", {
21 "ETFs": filtered_results
22 })
23{% for ETF in ETFs %}
24 <tr>
25 <td>{{ ETF.ticker }}</td>
26 <td>{{ ETF.full_name }}</td>
27 <td>{{ ETF.region.name }}</td> # What should I use in this line
28 </tr>
29{% endfor %}
30
The code is unable to render actual name of region, it just return None Result
- Ticker, Name, Region
- ARKF, ARK Fintech Innovation ETF, None
- ARKK, ARK Innovation ETF, None
- KEJI, Global X China Innovation, None
I would like to have this:
- Ticker, Name, Region
- ARKF, ARK Fintech Innovation ETF, Global
- ARKK, ARK Innovation ETF, Global
- KEJI, Global X China Innovation, China
I have the information in the database. I have checked it in admin.
ANSWER
Answered 2021-Aug-11 at 14:20Because you have many-to-many relationship, you cannot simply have single values. So, you have to list values.
1class Region(models.Model):
2 name = models.CharField(blank=False, unique=True)
3 def __str__(self):
4 return self.name
5
6class Theme(models.Model):
7 name = models.CharField(blank=False, unique=True)
8 slug = models.SlugField(default="", null=False)
9 def __str__(self):
10 return self.name
11
12class ETF(models.Model):
13 ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True)
14 full_name = models.CharField(max_length=200, blank=False)
15 # many to many
16 region = models.ManyToManyField(Region)
17 theme = models.ManyToManyField(Theme)
18def theme_etf(request, slug): # render ETFs with theme filter
19 filtered_results = ETF.objects.filter(theme__slug=slug)
20 return render(request, "etf/list_etf.html", {
21 "ETFs": filtered_results
22 })
23{% for ETF in ETFs %}
24 <tr>
25 <td>{{ ETF.ticker }}</td>
26 <td>{{ ETF.full_name }}</td>
27 <td>{{ ETF.region.name }}</td> # What should I use in this line
28 </tr>
29{% endfor %}
30{% for ETF in ETFs %}
31 <tr>
32 <td>{{ ETF.ticker }}</td>
33 <td>{{ ETF.full_name }}</td>
34 <td>
35 <ol>
36 {% for region in ETF.region %}
37 <li>{{region.name}}</li>
38 {% endfor %}
39 </ol>
40 </td>
41 </tr>
42{% endfor %}
43
QUESTION
Python web scraper, with BeautifulSoup I am having problem with my link , the link is now going to headline story but redirecting to the archives page
Asked 2021-Aug-02 at 13:19The link is redirecting me to an archives page with other top stories https://www.coindesk.com/news/babel-finance-bets-on-longtime-fintech-hand-to-help-navigate-regulatory-landscape. The tag news on the link between .com and babel should not be there as I believe it is that which is redirecting the news headline to another page.
1from bs4 import BeautifulSoup
2import requests
3
4
5base_url ='https://www.coindesk.com/news'
6
7source = requests.get(base_url).text
8
9soup = BeautifulSoup(source, "html.parser")
10
11
12articles = soup.find_all(class_ = 'list-item-card post')
13
14#print(len(articles))
15#print(articles)
16
17
18for article in articles:
19
20 headline = article.h4.text.strip()
21 link = base_url + article.find_all("a")[1]["href"]
22 text = article.find(class_="card-text").text.strip()
23 img_url = base_url+article.picture.img['src']
24
25 print(headline)
26 print(link)
27 print(text)
28 print("Image " + img_url)
29 ```
30
31
ANSWER
Answered 2021-Aug-02 at 13:19The error happens because you are concatinating your base link (which already includes /news/) to an absolute url
To prevent this, you can use urllib.parse.urljoin()
In your example this should fix the issue:
1from bs4 import BeautifulSoup
2import requests
3
4
5base_url ='https://www.coindesk.com/news'
6
7source = requests.get(base_url).text
8
9soup = BeautifulSoup(source, "html.parser")
10
11
12articles = soup.find_all(class_ = 'list-item-card post')
13
14#print(len(articles))
15#print(articles)
16
17
18for article in articles:
19
20 headline = article.h4.text.strip()
21 link = base_url + article.find_all("a")[1]["href"]
22 text = article.find(class_="card-text").text.strip()
23 img_url = base_url+article.picture.img['src']
24
25 print(headline)
26 print(link)
27 print(text)
28 print("Image " + img_url)
29 ```
30
31from urllib.parse import urljoin
32
33link = urljoin(base_url, article.find_all("a")[1]["href"])
34
QUESTION
Trying to get property 'title' of non-object Curl PHP
Asked 2021-Apr-28 at 11:05I have this Code which I am Using to Fetch Jobs From the Api:
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37
I am trying to access these values:
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43
I am Getting these warnings :
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44
on line 31
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45
on line 31
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46
on line 31
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47
on line 31
Where am I Doing wrong???
if I do var_dump($result);
then the output is this :
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48 ["__CLASS__"]=>
49 string(39) "Adzuna::API::Response::JobSearchResults"
50 ["results"]=>
51 array(20) {
52 [0]=>
53 object(stdClass)#2 (15) {
54 ["description"]=>
55 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
56 ["company"]=>
57 object(stdClass)#3 (2) {
58 ["display_name"]=>
59 string(7) "Ardotec"
60 ["__CLASS__"]=>
61 string(30) "Adzuna::API::Response::Company"
62 }
63 ["redirect_url"]=>
64 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
65 ["created"]=>
66 string(20) "2021-04-27T06:43:41Z"
67 ["__CLASS__"]=>
68 string(26) "Adzuna::API::Response::Job"
69 ["salary_is_predicted"]=>
70 string(1) "0"
71 ["longitude"]=>
72 float(-0.02806)
73 ["salary_min"]=>
74 int(45000)
75 ["category"]=>
76 object(stdClass)#4 (3) {
77 ["__CLASS__"]=>
78 string(31) "Adzuna::API::Response::Category"
79 ["tag"]=>
80 string(7) "it-jobs"
81 ["label"]=>
82 string(7) "IT Jobs"
83 }
84 ["latitude"]=>
85 float(51.451818)
86 ["title"]=>
87 string(74) "PHP Developer - REMOTE / PHP /Javascript"
88 ["id"]=>
89 string(10) "2143941919"
90 ["location"]=>
91 object(stdClass)#5 (3) {
92 ["__CLASS__"]=>
93 string(31) "Adzuna::API::Response::Location"
94 ["area"]=>
95 array(3) {
96 [0]=>
97 string(2) "UK"
98 [1]=>
99 string(6) "London"
100 [2]=>
101 string(17) "South East London"
102 }
103 ["display_name"]=>
104 string(25) "South East London, London"
105 }
106 ["salary_max"]=>
107 int(65000)
108 ["adref"]=>
109 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg"
110 }
111 [1]=>
112 object(stdClass)#6 (15) {
113 ["__CLASS__"]=>
114 string(26) "Adzuna::API::Response::Job"
115 ["created"]=>
116 string(20) "2021-04-20T22:25:33Z"
117 ["salary_is_predicted"]=>
118 string(1) "0"
119 ["redirect_url"]=>
120 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
121 ["salary_min"]=>
122 int(30000)
123 ["longitude"]=>
124 float(0.523168)
125 ["company"]=>
126 object(stdClass)#7 (2) {
127 ["__CLASS__"]=>
128 string(30) "Adzuna::API::Response::Company"
129 ["display_name"]=>
130 string(12) "White Stores"
131 }
132 ["description"]=>
133 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
134 ["location"]=>
135 object(stdClass)#8 (3) {
136 ["area"]=>
137 array(4) {
138 [0]=>
139 string(2) "UK"
140 [1]=>
141 string(15) "Eastern England"
142 [2]=>
143 string(5) "Essex"
144 [3]=>
145 string(8) "Wickford"
146 }
147 ["__CLASS__"]=>
148 string(31) "Adzuna::API::Response::Location"
149 ["display_name"]=>
150 string(15) "Wickford, Essex"
151 }
152 ["id"]=>
153 string(10) "2129749481"
154 ["adref"]=>
155 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM"
156 ["salary_max"]=>
157 int(35000)
158 ["category"]=>
159 object(stdClass)#9 (3) {
160 ["__CLASS__"]=>
161 string(31) "Adzuna::API::Response::Category"
162 ["tag"]=>
163 string(7) "it-jobs"
164 ["label"]=>
165 string(7) "IT Jobs"
166 }
167 ["latitude"]=>
168 float(51.6106)
169 ["title"]=>
170 string(30) "PHP Developer"
171 }
172
this is the result above I posted some of it as i am not able to post fully results here ...
if I do this:
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48 ["__CLASS__"]=>
49 string(39) "Adzuna::API::Response::JobSearchResults"
50 ["results"]=>
51 array(20) {
52 [0]=>
53 object(stdClass)#2 (15) {
54 ["description"]=>
55 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
56 ["company"]=>
57 object(stdClass)#3 (2) {
58 ["display_name"]=>
59 string(7) "Ardotec"
60 ["__CLASS__"]=>
61 string(30) "Adzuna::API::Response::Company"
62 }
63 ["redirect_url"]=>
64 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
65 ["created"]=>
66 string(20) "2021-04-27T06:43:41Z"
67 ["__CLASS__"]=>
68 string(26) "Adzuna::API::Response::Job"
69 ["salary_is_predicted"]=>
70 string(1) "0"
71 ["longitude"]=>
72 float(-0.02806)
73 ["salary_min"]=>
74 int(45000)
75 ["category"]=>
76 object(stdClass)#4 (3) {
77 ["__CLASS__"]=>
78 string(31) "Adzuna::API::Response::Category"
79 ["tag"]=>
80 string(7) "it-jobs"
81 ["label"]=>
82 string(7) "IT Jobs"
83 }
84 ["latitude"]=>
85 float(51.451818)
86 ["title"]=>
87 string(74) "PHP Developer - REMOTE / PHP /Javascript"
88 ["id"]=>
89 string(10) "2143941919"
90 ["location"]=>
91 object(stdClass)#5 (3) {
92 ["__CLASS__"]=>
93 string(31) "Adzuna::API::Response::Location"
94 ["area"]=>
95 array(3) {
96 [0]=>
97 string(2) "UK"
98 [1]=>
99 string(6) "London"
100 [2]=>
101 string(17) "South East London"
102 }
103 ["display_name"]=>
104 string(25) "South East London, London"
105 }
106 ["salary_max"]=>
107 int(65000)
108 ["adref"]=>
109 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg"
110 }
111 [1]=>
112 object(stdClass)#6 (15) {
113 ["__CLASS__"]=>
114 string(26) "Adzuna::API::Response::Job"
115 ["created"]=>
116 string(20) "2021-04-20T22:25:33Z"
117 ["salary_is_predicted"]=>
118 string(1) "0"
119 ["redirect_url"]=>
120 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
121 ["salary_min"]=>
122 int(30000)
123 ["longitude"]=>
124 float(0.523168)
125 ["company"]=>
126 object(stdClass)#7 (2) {
127 ["__CLASS__"]=>
128 string(30) "Adzuna::API::Response::Company"
129 ["display_name"]=>
130 string(12) "White Stores"
131 }
132 ["description"]=>
133 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
134 ["location"]=>
135 object(stdClass)#8 (3) {
136 ["area"]=>
137 array(4) {
138 [0]=>
139 string(2) "UK"
140 [1]=>
141 string(15) "Eastern England"
142 [2]=>
143 string(5) "Essex"
144 [3]=>
145 string(8) "Wickford"
146 }
147 ["__CLASS__"]=>
148 string(31) "Adzuna::API::Response::Location"
149 ["display_name"]=>
150 string(15) "Wickford, Essex"
151 }
152 ["id"]=>
153 string(10) "2129749481"
154 ["adref"]=>
155 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM"
156 ["salary_max"]=>
157 int(35000)
158 ["category"]=>
159 object(stdClass)#9 (3) {
160 ["__CLASS__"]=>
161 string(31) "Adzuna::API::Response::Category"
162 ["tag"]=>
163 string(7) "it-jobs"
164 ["label"]=>
165 string(7) "IT Jobs"
166 }
167 ["latitude"]=>
168 float(51.6106)
169 ["title"]=>
170 string(30) "PHP Developer"
171 }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo "<pre>";
179
180
181var_dump($result);
182
the output is like this ...
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48 ["__CLASS__"]=>
49 string(39) "Adzuna::API::Response::JobSearchResults"
50 ["results"]=>
51 array(20) {
52 [0]=>
53 object(stdClass)#2 (15) {
54 ["description"]=>
55 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
56 ["company"]=>
57 object(stdClass)#3 (2) {
58 ["display_name"]=>
59 string(7) "Ardotec"
60 ["__CLASS__"]=>
61 string(30) "Adzuna::API::Response::Company"
62 }
63 ["redirect_url"]=>
64 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
65 ["created"]=>
66 string(20) "2021-04-27T06:43:41Z"
67 ["__CLASS__"]=>
68 string(26) "Adzuna::API::Response::Job"
69 ["salary_is_predicted"]=>
70 string(1) "0"
71 ["longitude"]=>
72 float(-0.02806)
73 ["salary_min"]=>
74 int(45000)
75 ["category"]=>
76 object(stdClass)#4 (3) {
77 ["__CLASS__"]=>
78 string(31) "Adzuna::API::Response::Category"
79 ["tag"]=>
80 string(7) "it-jobs"
81 ["label"]=>
82 string(7) "IT Jobs"
83 }
84 ["latitude"]=>
85 float(51.451818)
86 ["title"]=>
87 string(74) "PHP Developer - REMOTE / PHP /Javascript"
88 ["id"]=>
89 string(10) "2143941919"
90 ["location"]=>
91 object(stdClass)#5 (3) {
92 ["__CLASS__"]=>
93 string(31) "Adzuna::API::Response::Location"
94 ["area"]=>
95 array(3) {
96 [0]=>
97 string(2) "UK"
98 [1]=>
99 string(6) "London"
100 [2]=>
101 string(17) "South East London"
102 }
103 ["display_name"]=>
104 string(25) "South East London, London"
105 }
106 ["salary_max"]=>
107 int(65000)
108 ["adref"]=>
109 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg"
110 }
111 [1]=>
112 object(stdClass)#6 (15) {
113 ["__CLASS__"]=>
114 string(26) "Adzuna::API::Response::Job"
115 ["created"]=>
116 string(20) "2021-04-20T22:25:33Z"
117 ["salary_is_predicted"]=>
118 string(1) "0"
119 ["redirect_url"]=>
120 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
121 ["salary_min"]=>
122 int(30000)
123 ["longitude"]=>
124 float(0.523168)
125 ["company"]=>
126 object(stdClass)#7 (2) {
127 ["__CLASS__"]=>
128 string(30) "Adzuna::API::Response::Company"
129 ["display_name"]=>
130 string(12) "White Stores"
131 }
132 ["description"]=>
133 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
134 ["location"]=>
135 object(stdClass)#8 (3) {
136 ["area"]=>
137 array(4) {
138 [0]=>
139 string(2) "UK"
140 [1]=>
141 string(15) "Eastern England"
142 [2]=>
143 string(5) "Essex"
144 [3]=>
145 string(8) "Wickford"
146 }
147 ["__CLASS__"]=>
148 string(31) "Adzuna::API::Response::Location"
149 ["display_name"]=>
150 string(15) "Wickford, Essex"
151 }
152 ["id"]=>
153 string(10) "2129749481"
154 ["adref"]=>
155 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM"
156 ["salary_max"]=>
157 int(35000)
158 ["category"]=>
159 object(stdClass)#9 (3) {
160 ["__CLASS__"]=>
161 string(31) "Adzuna::API::Response::Category"
162 ["tag"]=>
163 string(7) "it-jobs"
164 ["label"]=>
165 string(7) "IT Jobs"
166 }
167 ["latitude"]=>
168 float(51.6106)
169 ["title"]=>
170 string(30) "PHP Developer"
171 }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo "<pre>";
179
180
181var_dump($result);
182array(4) { ["mean"]=> float(45274.4) ["count"]=> int(6140) ["__CLASS__"]=> string(39) "Adzuna::API::Response::JobSearchResults" ["results"]=> array(20) {
183 [0]=>
184 array(15) {
185 ["salary_min"]=>
186 int(45000)
187 ["location"]=>
188 array(3) {
189 ["area"]=>
190 array(3) {
191 [0]=>
192 string(2) "UK"
193 [1]=>
194 string(6) "London"
195 [2]=>
196 string(17) "South East London"
197 }
198 ["display_name"]=>
199 string(25) "South East London, London"
200 ["__CLASS__"]=>
201 string(31) "Adzuna::API::Response::Location"
202 }
203 ["salary_max"]=>
204 int(65000)
205 ["description"]=>
206 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
207 ["__CLASS__"]=>
208 string(26) "Adzuna::API::Response::Job"
209 ["longitude"]=>
210 float(-0.02806)
211 ["title"]=>
212 string(74) "PHP Developer - REMOTE / PHP /Javascript"
213 ["adref"]=>
214 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0"
215 ["category"]=>
216 array(3) {
217 ["label"]=>
218 string(7) "IT Jobs"
219 ["tag"]=>
220 string(7) "it-jobs"
221 ["__CLASS__"]=>
222 string(31) "Adzuna::API::Response::Category"
223 }
224 ["redirect_url"]=>
225 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
226 ["created"]=>
227 string(20) "2021-04-27T06:43:41Z"
228 ["latitude"]=>
229 float(51.451818)
230 ["id"]=>
231 string(10) "2143941919"
232 ["salary_is_predicted"]=>
233 string(1) "0"
234 ["company"]=>
235 array(2) {
236 ["display_name"]=>
237 string(7) "Ardotec"
238 ["__CLASS__"]=>
239 string(30) "Adzuna::API::Response::Company"
240 }
241 }
242 [1]=>
243 array(15) {
244 ["salary_is_predicted"]=>
245 string(1) "0"
246 ["company"]=>
247 array(2) {
248 ["display_name"]=>
249 string(12) "White Stores"
250 ["__CLASS__"]=>
251 string(30) "Adzuna::API::Response::Company"
252 }
253 ["id"]=>
254 string(10) "2129749481"
255 ["latitude"]=>
256 float(51.6106)
257 ["created"]=>
258 string(20) "2021-04-20T22:25:33Z"
259 ["redirect_url"]=>
260 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
261 ["category"]=>
262 array(3) {
263 ["tag"]=>
264 string(7) "it-jobs"
265 ["__CLASS__"]=>
266 string(31) "Adzuna::API::Response::Category"
267 ["label"]=>
268 string(7) "IT Jobs"
269 }
270 ["adref"]=>
271 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ"
272 ["title"]=>
273 string(30) "PHP Developer"
274 ["longitude"]=>
275 float(0.523168)
276 ["description"]=>
277 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
278 ["__CLASS__"]=>
279 string(26) "Adzuna::API::Response::Job"
280 ["salary_max"]=>
281 int(35000)
282 ["location"]=>
283 array(3) {
284 ["display_name"]=>
285 string(15) "Wickford, Essex"
286 ["__CLASS__"]=>
287 string(31) "Adzuna::API::Response::Location"
288 ["area"]=>
289 array(4) {
290 [0]=>
291 string(2) "UK"
292 [1]=>
293 string(15) "Eastern England"
294 [2]=>
295 string(5) "Essex"
296 [3]=>
297 string(8) "Wickford"
298 }
299 }
300 ["salary_min"]=>
301 int(30000)
302 }
303 [2]=>
304 array(15) {
305 ["title"]=>
306 string(30) "PHP developer"
307 ["longitude"]=>
308 float(-2.29854)
309 ["description"]=>
310 string(419) "PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ... the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ..."
311 ["__CLASS__"]=>
312 string(26) "Adzuna::API::Response::Job"
313 ["salary_max"]=>
314 int(32000)
315 ["location"]=>
316 array(3) {
317 ["display_name"]=>
318 string(24) "Bury, Greater Manchester"
319 ["__CLASS__"]=>
320 string(31) "Adzuna::API::Response::Location"
321 ["area"]=>
322 array(4) {
323 [0]=>
324 string(2) "UK"
325 [1]=>
326 string(18) "North West England"
327 [2]=>
328 string(18) "Greater Manchester"
329 [3]=>
330 string(4) "Bury"
331 }
332 }
333 ["salary_min"]=>
334 int(28000)
335 ["salary_is_predicted"]=>
336 string(1) "0"
337 ["company"]=>
338 array(2) {
339 ["display_name"]=>
340 string(6) "Capita"
341 ["__CLASS__"]=>
342 string(30) "Adzuna::API::Response::Company"
343 }
344 ["id"]=>
345 string(10) "2102200703"
346 ["latitude"]=>
347 float(53.593498)
348 ["redirect_url"]=>
349 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=395C49C57A5FC0605CD718A9D5FDF04E985F3780"
350 ["created"]=>
351 string(20) "2021-04-06T18:58:11Z"
352 ["category"]=>
353 array(3) {
354 ["label"]=>
355 string(7) "IT Jobs"
356 ["tag"]=>
357 string(7) "it-jobs"
358 ["__CLASS__"]=>
359 string(31) "Adzuna::API::Response::Category"
360 }
361 ["adref"]=>
362 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0"
363 }
364 [3]=>
365 array(13) {
366 ["location"]=>
367 array(3) {
368 ["__CLASS__"]=>
369 string(31) "Adzuna::API::Response::Location"
370 ["display_name"]=>
371 string(2) "UK"
372 ["area"]=>
373 array(1) {
374 [0]=>
375 string(2) "UK"
376 }
377 }
378 ["salary_min"]=>
379 int(0)
380 ["description"]=>
381 string(408) "Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ... revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ..."
382 ["__CLASS__"]=>
383 string(26) "Adzuna::API::Response::Job"
384 ["salary_max"]=>
385 int(65000)
386 ["title"]=>
387 string(30) "PHP Developer"
388 ["category"]=>
389 array(3) {
390 ["label"]=>
391 string(7) "IT Jobs"
392 ["__CLASS__"]=>
393 string(31) "Adzuna::API::Response::Category"
394 ["tag"]=>
395 string(7) "it-jobs"
396 }
397 ["adref"]=>
398 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8"
399 ["redirect_url"]=>
400 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=2720D4577AE58EBCB28D1478075CC47866B3CF33"
401 ["created"]=>
402 string(20) "2021-04-01T18:21:44Z"
403 ["id"]=>
404 string(10) "2091430430"
405 ["company"]=>
406 array(2) {
407 ["display_name"]=>
408 string(10) "technologi"
409 ["__CLASS__"]=>
410 string(30) "Adzuna::API::Response::Company"
411 }
412 ["salary_is_predicted"]=>
413 string(1) "0"
414 }
415
Thanks In Advance..
ANSWER
Answered 2021-Apr-28 at 11:05so it becomes like this
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48 ["__CLASS__"]=>
49 string(39) "Adzuna::API::Response::JobSearchResults"
50 ["results"]=>
51 array(20) {
52 [0]=>
53 object(stdClass)#2 (15) {
54 ["description"]=>
55 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
56 ["company"]=>
57 object(stdClass)#3 (2) {
58 ["display_name"]=>
59 string(7) "Ardotec"
60 ["__CLASS__"]=>
61 string(30) "Adzuna::API::Response::Company"
62 }
63 ["redirect_url"]=>
64 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
65 ["created"]=>
66 string(20) "2021-04-27T06:43:41Z"
67 ["__CLASS__"]=>
68 string(26) "Adzuna::API::Response::Job"
69 ["salary_is_predicted"]=>
70 string(1) "0"
71 ["longitude"]=>
72 float(-0.02806)
73 ["salary_min"]=>
74 int(45000)
75 ["category"]=>
76 object(stdClass)#4 (3) {
77 ["__CLASS__"]=>
78 string(31) "Adzuna::API::Response::Category"
79 ["tag"]=>
80 string(7) "it-jobs"
81 ["label"]=>
82 string(7) "IT Jobs"
83 }
84 ["latitude"]=>
85 float(51.451818)
86 ["title"]=>
87 string(74) "PHP Developer - REMOTE / PHP /Javascript"
88 ["id"]=>
89 string(10) "2143941919"
90 ["location"]=>
91 object(stdClass)#5 (3) {
92 ["__CLASS__"]=>
93 string(31) "Adzuna::API::Response::Location"
94 ["area"]=>
95 array(3) {
96 [0]=>
97 string(2) "UK"
98 [1]=>
99 string(6) "London"
100 [2]=>
101 string(17) "South East London"
102 }
103 ["display_name"]=>
104 string(25) "South East London, London"
105 }
106 ["salary_max"]=>
107 int(65000)
108 ["adref"]=>
109 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg"
110 }
111 [1]=>
112 object(stdClass)#6 (15) {
113 ["__CLASS__"]=>
114 string(26) "Adzuna::API::Response::Job"
115 ["created"]=>
116 string(20) "2021-04-20T22:25:33Z"
117 ["salary_is_predicted"]=>
118 string(1) "0"
119 ["redirect_url"]=>
120 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
121 ["salary_min"]=>
122 int(30000)
123 ["longitude"]=>
124 float(0.523168)
125 ["company"]=>
126 object(stdClass)#7 (2) {
127 ["__CLASS__"]=>
128 string(30) "Adzuna::API::Response::Company"
129 ["display_name"]=>
130 string(12) "White Stores"
131 }
132 ["description"]=>
133 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
134 ["location"]=>
135 object(stdClass)#8 (3) {
136 ["area"]=>
137 array(4) {
138 [0]=>
139 string(2) "UK"
140 [1]=>
141 string(15) "Eastern England"
142 [2]=>
143 string(5) "Essex"
144 [3]=>
145 string(8) "Wickford"
146 }
147 ["__CLASS__"]=>
148 string(31) "Adzuna::API::Response::Location"
149 ["display_name"]=>
150 string(15) "Wickford, Essex"
151 }
152 ["id"]=>
153 string(10) "2129749481"
154 ["adref"]=>
155 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM"
156 ["salary_max"]=>
157 int(35000)
158 ["category"]=>
159 object(stdClass)#9 (3) {
160 ["__CLASS__"]=>
161 string(31) "Adzuna::API::Response::Category"
162 ["tag"]=>
163 string(7) "it-jobs"
164 ["label"]=>
165 string(7) "IT Jobs"
166 }
167 ["latitude"]=>
168 float(51.6106)
169 ["title"]=>
170 string(30) "PHP Developer"
171 }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo "<pre>";
179
180
181var_dump($result);
182array(4) { ["mean"]=> float(45274.4) ["count"]=> int(6140) ["__CLASS__"]=> string(39) "Adzuna::API::Response::JobSearchResults" ["results"]=> array(20) {
183 [0]=>
184 array(15) {
185 ["salary_min"]=>
186 int(45000)
187 ["location"]=>
188 array(3) {
189 ["area"]=>
190 array(3) {
191 [0]=>
192 string(2) "UK"
193 [1]=>
194 string(6) "London"
195 [2]=>
196 string(17) "South East London"
197 }
198 ["display_name"]=>
199 string(25) "South East London, London"
200 ["__CLASS__"]=>
201 string(31) "Adzuna::API::Response::Location"
202 }
203 ["salary_max"]=>
204 int(65000)
205 ["description"]=>
206 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
207 ["__CLASS__"]=>
208 string(26) "Adzuna::API::Response::Job"
209 ["longitude"]=>
210 float(-0.02806)
211 ["title"]=>
212 string(74) "PHP Developer - REMOTE / PHP /Javascript"
213 ["adref"]=>
214 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0"
215 ["category"]=>
216 array(3) {
217 ["label"]=>
218 string(7) "IT Jobs"
219 ["tag"]=>
220 string(7) "it-jobs"
221 ["__CLASS__"]=>
222 string(31) "Adzuna::API::Response::Category"
223 }
224 ["redirect_url"]=>
225 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
226 ["created"]=>
227 string(20) "2021-04-27T06:43:41Z"
228 ["latitude"]=>
229 float(51.451818)
230 ["id"]=>
231 string(10) "2143941919"
232 ["salary_is_predicted"]=>
233 string(1) "0"
234 ["company"]=>
235 array(2) {
236 ["display_name"]=>
237 string(7) "Ardotec"
238 ["__CLASS__"]=>
239 string(30) "Adzuna::API::Response::Company"
240 }
241 }
242 [1]=>
243 array(15) {
244 ["salary_is_predicted"]=>
245 string(1) "0"
246 ["company"]=>
247 array(2) {
248 ["display_name"]=>
249 string(12) "White Stores"
250 ["__CLASS__"]=>
251 string(30) "Adzuna::API::Response::Company"
252 }
253 ["id"]=>
254 string(10) "2129749481"
255 ["latitude"]=>
256 float(51.6106)
257 ["created"]=>
258 string(20) "2021-04-20T22:25:33Z"
259 ["redirect_url"]=>
260 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
261 ["category"]=>
262 array(3) {
263 ["tag"]=>
264 string(7) "it-jobs"
265 ["__CLASS__"]=>
266 string(31) "Adzuna::API::Response::Category"
267 ["label"]=>
268 string(7) "IT Jobs"
269 }
270 ["adref"]=>
271 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ"
272 ["title"]=>
273 string(30) "PHP Developer"
274 ["longitude"]=>
275 float(0.523168)
276 ["description"]=>
277 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
278 ["__CLASS__"]=>
279 string(26) "Adzuna::API::Response::Job"
280 ["salary_max"]=>
281 int(35000)
282 ["location"]=>
283 array(3) {
284 ["display_name"]=>
285 string(15) "Wickford, Essex"
286 ["__CLASS__"]=>
287 string(31) "Adzuna::API::Response::Location"
288 ["area"]=>
289 array(4) {
290 [0]=>
291 string(2) "UK"
292 [1]=>
293 string(15) "Eastern England"
294 [2]=>
295 string(5) "Essex"
296 [3]=>
297 string(8) "Wickford"
298 }
299 }
300 ["salary_min"]=>
301 int(30000)
302 }
303 [2]=>
304 array(15) {
305 ["title"]=>
306 string(30) "PHP developer"
307 ["longitude"]=>
308 float(-2.29854)
309 ["description"]=>
310 string(419) "PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ... the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ..."
311 ["__CLASS__"]=>
312 string(26) "Adzuna::API::Response::Job"
313 ["salary_max"]=>
314 int(32000)
315 ["location"]=>
316 array(3) {
317 ["display_name"]=>
318 string(24) "Bury, Greater Manchester"
319 ["__CLASS__"]=>
320 string(31) "Adzuna::API::Response::Location"
321 ["area"]=>
322 array(4) {
323 [0]=>
324 string(2) "UK"
325 [1]=>
326 string(18) "North West England"
327 [2]=>
328 string(18) "Greater Manchester"
329 [3]=>
330 string(4) "Bury"
331 }
332 }
333 ["salary_min"]=>
334 int(28000)
335 ["salary_is_predicted"]=>
336 string(1) "0"
337 ["company"]=>
338 array(2) {
339 ["display_name"]=>
340 string(6) "Capita"
341 ["__CLASS__"]=>
342 string(30) "Adzuna::API::Response::Company"
343 }
344 ["id"]=>
345 string(10) "2102200703"
346 ["latitude"]=>
347 float(53.593498)
348 ["redirect_url"]=>
349 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=395C49C57A5FC0605CD718A9D5FDF04E985F3780"
350 ["created"]=>
351 string(20) "2021-04-06T18:58:11Z"
352 ["category"]=>
353 array(3) {
354 ["label"]=>
355 string(7) "IT Jobs"
356 ["tag"]=>
357 string(7) "it-jobs"
358 ["__CLASS__"]=>
359 string(31) "Adzuna::API::Response::Category"
360 }
361 ["adref"]=>
362 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0"
363 }
364 [3]=>
365 array(13) {
366 ["location"]=>
367 array(3) {
368 ["__CLASS__"]=>
369 string(31) "Adzuna::API::Response::Location"
370 ["display_name"]=>
371 string(2) "UK"
372 ["area"]=>
373 array(1) {
374 [0]=>
375 string(2) "UK"
376 }
377 }
378 ["salary_min"]=>
379 int(0)
380 ["description"]=>
381 string(408) "Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ... revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ..."
382 ["__CLASS__"]=>
383 string(26) "Adzuna::API::Response::Job"
384 ["salary_max"]=>
385 int(65000)
386 ["title"]=>
387 string(30) "PHP Developer"
388 ["category"]=>
389 array(3) {
390 ["label"]=>
391 string(7) "IT Jobs"
392 ["__CLASS__"]=>
393 string(31) "Adzuna::API::Response::Category"
394 ["tag"]=>
395 string(7) "it-jobs"
396 }
397 ["adref"]=>
398 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8"
399 ["redirect_url"]=>
400 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=2720D4577AE58EBCB28D1478075CC47866B3CF33"
401 ["created"]=>
402 string(20) "2021-04-01T18:21:44Z"
403 ["id"]=>
404 string(10) "2091430430"
405 ["company"]=>
406 array(2) {
407 ["display_name"]=>
408 string(10) "technologi"
409 ["__CLASS__"]=>
410 string(30) "Adzuna::API::Response::Company"
411 }
412 ["salary_is_predicted"]=>
413 string(1) "0"
414 }
415$result=json_decode(curl_exec($ch),false);
416
417foreach ($result->results as $job){
418echo $job->id;
419}
420
and when the json parameter is true i.e ..
then this :
1 <?php
2
3$header[] = "Content-Type:application/x-www-form-urlencoded";
4 $header[] = "Accept:application/json";
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,"http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&app_key=KEY&results_per_page=20&what=PHP");
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,"id=333");
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo "<pre>";
28
29
30//print_r($result);
31
32foreach ($result as $row){
33 echo $row->title;
34}
35
36?>
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48 ["__CLASS__"]=>
49 string(39) "Adzuna::API::Response::JobSearchResults"
50 ["results"]=>
51 array(20) {
52 [0]=>
53 object(stdClass)#2 (15) {
54 ["description"]=>
55 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
56 ["company"]=>
57 object(stdClass)#3 (2) {
58 ["display_name"]=>
59 string(7) "Ardotec"
60 ["__CLASS__"]=>
61 string(30) "Adzuna::API::Response::Company"
62 }
63 ["redirect_url"]=>
64 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
65 ["created"]=>
66 string(20) "2021-04-27T06:43:41Z"
67 ["__CLASS__"]=>
68 string(26) "Adzuna::API::Response::Job"
69 ["salary_is_predicted"]=>
70 string(1) "0"
71 ["longitude"]=>
72 float(-0.02806)
73 ["salary_min"]=>
74 int(45000)
75 ["category"]=>
76 object(stdClass)#4 (3) {
77 ["__CLASS__"]=>
78 string(31) "Adzuna::API::Response::Category"
79 ["tag"]=>
80 string(7) "it-jobs"
81 ["label"]=>
82 string(7) "IT Jobs"
83 }
84 ["latitude"]=>
85 float(51.451818)
86 ["title"]=>
87 string(74) "PHP Developer - REMOTE / PHP /Javascript"
88 ["id"]=>
89 string(10) "2143941919"
90 ["location"]=>
91 object(stdClass)#5 (3) {
92 ["__CLASS__"]=>
93 string(31) "Adzuna::API::Response::Location"
94 ["area"]=>
95 array(3) {
96 [0]=>
97 string(2) "UK"
98 [1]=>
99 string(6) "London"
100 [2]=>
101 string(17) "South East London"
102 }
103 ["display_name"]=>
104 string(25) "South East London, London"
105 }
106 ["salary_max"]=>
107 int(65000)
108 ["adref"]=>
109 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg"
110 }
111 [1]=>
112 object(stdClass)#6 (15) {
113 ["__CLASS__"]=>
114 string(26) "Adzuna::API::Response::Job"
115 ["created"]=>
116 string(20) "2021-04-20T22:25:33Z"
117 ["salary_is_predicted"]=>
118 string(1) "0"
119 ["redirect_url"]=>
120 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
121 ["salary_min"]=>
122 int(30000)
123 ["longitude"]=>
124 float(0.523168)
125 ["company"]=>
126 object(stdClass)#7 (2) {
127 ["__CLASS__"]=>
128 string(30) "Adzuna::API::Response::Company"
129 ["display_name"]=>
130 string(12) "White Stores"
131 }
132 ["description"]=>
133 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
134 ["location"]=>
135 object(stdClass)#8 (3) {
136 ["area"]=>
137 array(4) {
138 [0]=>
139 string(2) "UK"
140 [1]=>
141 string(15) "Eastern England"
142 [2]=>
143 string(5) "Essex"
144 [3]=>
145 string(8) "Wickford"
146 }
147 ["__CLASS__"]=>
148 string(31) "Adzuna::API::Response::Location"
149 ["display_name"]=>
150 string(15) "Wickford, Essex"
151 }
152 ["id"]=>
153 string(10) "2129749481"
154 ["adref"]=>
155 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM"
156 ["salary_max"]=>
157 int(35000)
158 ["category"]=>
159 object(stdClass)#9 (3) {
160 ["__CLASS__"]=>
161 string(31) "Adzuna::API::Response::Category"
162 ["tag"]=>
163 string(7) "it-jobs"
164 ["label"]=>
165 string(7) "IT Jobs"
166 }
167 ["latitude"]=>
168 float(51.6106)
169 ["title"]=>
170 string(30) "PHP Developer"
171 }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo "<pre>";
179
180
181var_dump($result);
182array(4) { ["mean"]=> float(45274.4) ["count"]=> int(6140) ["__CLASS__"]=> string(39) "Adzuna::API::Response::JobSearchResults" ["results"]=> array(20) {
183 [0]=>
184 array(15) {
185 ["salary_min"]=>
186 int(45000)
187 ["location"]=>
188 array(3) {
189 ["area"]=>
190 array(3) {
191 [0]=>
192 string(2) "UK"
193 [1]=>
194 string(6) "London"
195 [2]=>
196 string(17) "South East London"
197 }
198 ["display_name"]=>
199 string(25) "South East London, London"
200 ["__CLASS__"]=>
201 string(31) "Adzuna::API::Response::Location"
202 }
203 ["salary_max"]=>
204 int(65000)
205 ["description"]=>
206 string(436) "PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ..."
207 ["__CLASS__"]=>
208 string(26) "Adzuna::API::Response::Job"
209 ["longitude"]=>
210 float(-0.02806)
211 ["title"]=>
212 string(74) "PHP Developer - REMOTE / PHP /Javascript"
213 ["adref"]=>
214 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0"
215 ["category"]=>
216 array(3) {
217 ["label"]=>
218 string(7) "IT Jobs"
219 ["tag"]=>
220 string(7) "it-jobs"
221 ["__CLASS__"]=>
222 string(31) "Adzuna::API::Response::Category"
223 }
224 ["redirect_url"]=>
225 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=07CB17CA90C1D1FC9E83060222D3D3C904E39638"
226 ["created"]=>
227 string(20) "2021-04-27T06:43:41Z"
228 ["latitude"]=>
229 float(51.451818)
230 ["id"]=>
231 string(10) "2143941919"
232 ["salary_is_predicted"]=>
233 string(1) "0"
234 ["company"]=>
235 array(2) {
236 ["display_name"]=>
237 string(7) "Ardotec"
238 ["__CLASS__"]=>
239 string(30) "Adzuna::API::Response::Company"
240 }
241 }
242 [1]=>
243 array(15) {
244 ["salary_is_predicted"]=>
245 string(1) "0"
246 ["company"]=>
247 array(2) {
248 ["display_name"]=>
249 string(12) "White Stores"
250 ["__CLASS__"]=>
251 string(30) "Adzuna::API::Response::Company"
252 }
253 ["id"]=>
254 string(10) "2129749481"
255 ["latitude"]=>
256 float(51.6106)
257 ["created"]=>
258 string(20) "2021-04-20T22:25:33Z"
259 ["redirect_url"]=>
260 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97"
261 ["category"]=>
262 array(3) {
263 ["tag"]=>
264 string(7) "it-jobs"
265 ["__CLASS__"]=>
266 string(31) "Adzuna::API::Response::Category"
267 ["label"]=>
268 string(7) "IT Jobs"
269 }
270 ["adref"]=>
271 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ"
272 ["title"]=>
273 string(30) "PHP Developer"
274 ["longitude"]=>
275 float(0.523168)
276 ["description"]=>
277 string(406) "PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ..."
278 ["__CLASS__"]=>
279 string(26) "Adzuna::API::Response::Job"
280 ["salary_max"]=>
281 int(35000)
282 ["location"]=>
283 array(3) {
284 ["display_name"]=>
285 string(15) "Wickford, Essex"
286 ["__CLASS__"]=>
287 string(31) "Adzuna::API::Response::Location"
288 ["area"]=>
289 array(4) {
290 [0]=>
291 string(2) "UK"
292 [1]=>
293 string(15) "Eastern England"
294 [2]=>
295 string(5) "Essex"
296 [3]=>
297 string(8) "Wickford"
298 }
299 }
300 ["salary_min"]=>
301 int(30000)
302 }
303 [2]=>
304 array(15) {
305 ["title"]=>
306 string(30) "PHP developer"
307 ["longitude"]=>
308 float(-2.29854)
309 ["description"]=>
310 string(419) "PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ... the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ..."
311 ["__CLASS__"]=>
312 string(26) "Adzuna::API::Response::Job"
313 ["salary_max"]=>
314 int(32000)
315 ["location"]=>
316 array(3) {
317 ["display_name"]=>
318 string(24) "Bury, Greater Manchester"
319 ["__CLASS__"]=>
320 string(31) "Adzuna::API::Response::Location"
321 ["area"]=>
322 array(4) {
323 [0]=>
324 string(2) "UK"
325 [1]=>
326 string(18) "North West England"
327 [2]=>
328 string(18) "Greater Manchester"
329 [3]=>
330 string(4) "Bury"
331 }
332 }
333 ["salary_min"]=>
334 int(28000)
335 ["salary_is_predicted"]=>
336 string(1) "0"
337 ["company"]=>
338 array(2) {
339 ["display_name"]=>
340 string(6) "Capita"
341 ["__CLASS__"]=>
342 string(30) "Adzuna::API::Response::Company"
343 }
344 ["id"]=>
345 string(10) "2102200703"
346 ["latitude"]=>
347 float(53.593498)
348 ["redirect_url"]=>
349 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=395C49C57A5FC0605CD718A9D5FDF04E985F3780"
350 ["created"]=>
351 string(20) "2021-04-06T18:58:11Z"
352 ["category"]=>
353 array(3) {
354 ["label"]=>
355 string(7) "IT Jobs"
356 ["tag"]=>
357 string(7) "it-jobs"
358 ["__CLASS__"]=>
359 string(31) "Adzuna::API::Response::Category"
360 }
361 ["adref"]=>
362 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0"
363 }
364 [3]=>
365 array(13) {
366 ["location"]=>
367 array(3) {
368 ["__CLASS__"]=>
369 string(31) "Adzuna::API::Response::Location"
370 ["display_name"]=>
371 string(2) "UK"
372 ["area"]=>
373 array(1) {
374 [0]=>
375 string(2) "UK"
376 }
377 }
378 ["salary_min"]=>
379 int(0)
380 ["description"]=>
381 string(408) "Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ... revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ..."
382 ["__CLASS__"]=>
383 string(26) "Adzuna::API::Response::Job"
384 ["salary_max"]=>
385 int(65000)
386 ["title"]=>
387 string(30) "PHP Developer"
388 ["category"]=>
389 array(3) {
390 ["label"]=>
391 string(7) "IT Jobs"
392 ["__CLASS__"]=>
393 string(31) "Adzuna::API::Response::Category"
394 ["tag"]=>
395 string(7) "it-jobs"
396 }
397 ["adref"]=>
398 string(128) "eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8"
399 ["redirect_url"]=>
400 string(152) "https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&utm_medium=api&utm_source=f6e0907b&v=2720D4577AE58EBCB28D1478075CC47866B3CF33"
401 ["created"]=>
402 string(20) "2021-04-01T18:21:44Z"
403 ["id"]=>
404 string(10) "2091430430"
405 ["company"]=>
406 array(2) {
407 ["display_name"]=>
408 string(10) "technologi"
409 ["__CLASS__"]=>
410 string(30) "Adzuna::API::Response::Company"
411 }
412 ["salary_is_predicted"]=>
413 string(1) "0"
414 }
415$result=json_decode(curl_exec($ch),false);
416
417foreach ($result->results as $job){
418echo $job->id;
419}
420$result=json_decode(curl_exec($ch),true);
421
422foreach ($result['results'] as $job){
423
424echo $job['id'];
425
426}
427
QUESTION
Using float left and right/ width 50% is not allowing my content to be responsive on mobile view
Asked 2021-Mar-10 at 10:41I'm using "tiles" to show content, clicking on a tile expands content. Within the expanding content, I'm using the left hand side for displaying text (spec-info
) and for the right hand side I'm using (icon-percent
) to display an icon. I'm happy with this outcome as the icon sitting at the right hand side is positioned well in comparison to the text. However when on smaller device sizes, (ipad, iphone) - the "split" view of using left and right would be reverted to full width with the icon scaling appropriately and displaying above the text. I'm familiar with media queries but not sure they're appropriate for this implementation? any ideas would be really appreciated! I've created a working fiddle here too: https://jsfiddle.net/6gsvjt4r/1/
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}body {
41 margin: 0;
42 font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46 padding-top: 70px;
47}
48
49.section-content-specialisms {
50 max-width: $page-width;
51 margin: 0 auto;
52 padding: 0 $p-base;
53 margin-bottom: 70px;
54
55 justify-content: space-between;
56 position: relative;
57}
58
59@media (min-width: $tablets) {
60 .section-content-specialisms {
61 flex-direction: row;
62 padding-left: 2rem;
63 padding-right: 2rem;
64 }
65}
66
67.box {
68 display: flex;
69 flex-wrap: wrap;
70 flex-direction: row;
71 padding-right: 6rem;
72 padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78 box-sizing: border-box;
79}
80
81.tile > * {
82 pointer-events: none;
83}
84
85.tile {
86 flex: 1 0 auto;
87 order: 0;
88 flex-basis: 25%;
89 border: 1px solid grey;
90
91 /* For visual only */
92 background-color: #222;
93 height: 150px;
94 text-align: center;
95 font-size: 16px;
96 color: white;
97 cursor: pointer;
98}
99
100.active-tile {
101 flex: 1 0 auto;
102 order: 0;
103 flex-basis: 25%;
104
105 /* For visual only */
106 text-align: center;
107 border: 1px solid #000;
108 background-color: green;
109 cursor: pointer;
110}
111
112.content {
113 order: 1;
114 flex: 1 0 100%;
115
116 /* For visual only */
117 padding: 20px;
118 color: black;
119 text-align: center;
120 border: 1px solid #000;
121 background-color: #228b22;
122}
123
124.description {
125 text-align: left;
126}
127
128.spec-info {
129 text-align: left;
130 width: 50%;
131 float: left;
132}
133
134.percent-icon-size {
135 width: 295px;
136 height: 260px;
137}
138
139.icon-percent {
140 width: 50%;
141 float: right;
142}
143
144.icon-spacing {
145 margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150 content: "";
151 display: table;
152 clear: both;
153}
154
155.closebtn {
156 float: right;
157 color: black;
158 cursor: pointer;
159}
160
161.arrow-down {
162 width: 25px;
163 height: 25px;
164}
165
166.arrow-up {
167 width: 25px;
168 height: 25px;
169 -webkit-transform: rotate(180deg);
170 -moz-transform: rotate(180deg);
171 -ms-transform: rotate(180deg);
172 -o-transform: rotate(180deg);
173 transform: rotate(180deg);
174}
175
176.specialisms-content {
177 padding-top: 25px;
178 padding-bottom: 25px;
179}
180
181.percentage {
182 color: #228b22;
183}
184
185/*
186 "Desktop" and above
187 */
188@media (max-width: 480px) {
189 .box {
190 flex-direction: column;
191 padding-right: 1rem;
192 padding-left: 1rem;
193 }
194
195 .content {
196 order: 0;
197 }
198}
199
200@media (max-width: 768px) {
201 .box {
202 padding-right: 1rem;
203 padding-left: 1rem;
204 }
205}
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}body {
41 margin: 0;
42 font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46 padding-top: 70px;
47}
48
49.section-content-specialisms {
50 max-width: $page-width;
51 margin: 0 auto;
52 padding: 0 $p-base;
53 margin-bottom: 70px;
54
55 justify-content: space-between;
56 position: relative;
57}
58
59@media (min-width: $tablets) {
60 .section-content-specialisms {
61 flex-direction: row;
62 padding-left: 2rem;
63 padding-right: 2rem;
64 }
65}
66
67.box {
68 display: flex;
69 flex-wrap: wrap;
70 flex-direction: row;
71 padding-right: 6rem;
72 padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78 box-sizing: border-box;
79}
80
81.tile > * {
82 pointer-events: none;
83}
84
85.tile {
86 flex: 1 0 auto;
87 order: 0;
88 flex-basis: 25%;
89 border: 1px solid grey;
90
91 /* For visual only */
92 background-color: #222;
93 height: 150px;
94 text-align: center;
95 font-size: 16px;
96 color: white;
97 cursor: pointer;
98}
99
100.active-tile {
101 flex: 1 0 auto;
102 order: 0;
103 flex-basis: 25%;
104
105 /* For visual only */
106 text-align: center;
107 border: 1px solid #000;
108 background-color: green;
109 cursor: pointer;
110}
111
112.content {
113 order: 1;
114 flex: 1 0 100%;
115
116 /* For visual only */
117 padding: 20px;
118 color: black;
119 text-align: center;
120 border: 1px solid #000;
121 background-color: #228b22;
122}
123
124.description {
125 text-align: left;
126}
127
128.spec-info {
129 text-align: left;
130 width: 50%;
131 float: left;
132}
133
134.percent-icon-size {
135 width: 295px;
136 height: 260px;
137}
138
139.icon-percent {
140 width: 50%;
141 float: right;
142}
143
144.icon-spacing {
145 margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150 content: "";
151 display: table;
152 clear: both;
153}
154
155.closebtn {
156 float: right;
157 color: black;
158 cursor: pointer;
159}
160
161.arrow-down {
162 width: 25px;
163 height: 25px;
164}
165
166.arrow-up {
167 width: 25px;
168 height: 25px;
169 -webkit-transform: rotate(180deg);
170 -moz-transform: rotate(180deg);
171 -ms-transform: rotate(180deg);
172 -o-transform: rotate(180deg);
173 transform: rotate(180deg);
174}
175
176.specialisms-content {
177 padding-top: 25px;
178 padding-bottom: 25px;
179}
180
181.percentage {
182 color: #228b22;
183}
184
185/*
186 "Desktop" and above
187 */
188@media (max-width: 480px) {
189 .box {
190 flex-direction: column;
191 padding-right: 1rem;
192 padding-left: 1rem;
193 }
194
195 .content {
196 order: 0;
197 }
198}
199
200@media (max-width: 768px) {
201 .box {
202 padding-right: 1rem;
203 padding-left: 1rem;
204 }
205}<div class="box">
206 <div class="tile" onclick="openTab('b1', event);">
207 <img class="icon-spacing" src="./assets/Icons/Banking.svg" />
208 <p>Banking</p>
209 <img class="arrow-down" src="./assets/Icons/arrow-down.png" />
210 </div>
211 <div
212 id="b1"
213 class="content"
214 style="display: none; background: white"
215 >
216 <span onclick="closeTab('b1', event)" class="closebtn"
217 >&times;</span
218 >
219 <div class="expanded-content"></div>
220
221 <div class="spec-info">
222 <h3>Banking</h3>
223 <p>
224 Core banking products including personal current accounts,
225 savings and mortgages. This category also includes banking
226 platforms and operations FinTechs such as Railsbank and
227 challenger banks such as Atom.
228 </p>
229 <ul>
230 <li>Banking Personal Current Accounts (PCA)</li>
231 <li>Banking Platforms</li>
232 <li>Banking Operations</li>
233 </ul>
234 </div>
235 <div class="icon-percent">
236 <img src="./assets/37.png" alt="" class="percent-icon-size" />
237 </div>
238 </div>
239<div class="tile" onclick="openTab('b2', event);">
240<img class="icon-spacing" src="./assets/Icons/Regtech.svg" />
241<p>RegTech</p>
242<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
243</div>
244<div id="b2" class="content" style="display: none; background: white">
245<span onclick="closeTab('b2', event)" class="closebtn">&times;</span>
246<div class="description">
247<h3>RegTech - <span class="percentage">10%</span></h3>
248<p>
249 This FinTech category focuses on companies with activities and
250 technology focused on reimagining and streamlining risk (AML, KYC),
251 credit scoring and compliance software.
252</p>
253</div>
254</div>
255<div class="tile" onclick="openTab('b3', event);">
256<img class="icon-spacing" src="./assets/Icons/InsurTech.svg" />
257<p>InsurTech</p>
258<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
259</div>
260<div id="b3" class="content" style="display: none; background: white">
261<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
262<div class="description">
263<h3>InsurTech - <span class="percentage">6%</span></h3>
264<p>
265 InsurTech includes companies selling insurance digitally or introducing
266 new business models or (re)insurance specific software.
267</p>
268<ul>
269 <li>InsurTech - Commercial</li>
270 <li>InsurTech - Personal</li>
271 <li>Insurance Platforms and Operations</li>
272</ul>
273</div>
274</div>
275<div class="tile" onclick="openTab('b4', event);">
276<img class="icon-spacing" src="./assets/Icons/Lending.svg" />
277<p>Lending</p>
278<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
279</div>
280<div id="b4" class="content" style="display: none; background: white">
281<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
282<div class="description">
283<h3>Lending - <span class="percentage">13%</span></h3>
284<p>
285 Companies focused on innnovating credit, from commerical to alternative
286 and specialist lenders or platforms facilitating P2P.
287</p>
288<ul>
289 <li>Consumer Lending</li>
290 <li>Commercial Lending</li>
291 <li>P2P Lending</li>
292</ul>
293</div>
294</div>
295</div>
ANSWER
Answered 2021-Mar-09 at 18:36There are a couple of things I'd suggest doing:
Remove fixed sizing on the .percent-icon-size image
I see in your CSS, you have the height and width set on
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}body {
41 margin: 0;
42 font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46 padding-top: 70px;
47}
48
49.section-content-specialisms {
50 max-width: $page-width;
51 margin: 0 auto;
52 padding: 0 $p-base;
53 margin-bottom: 70px;
54
55 justify-content: space-between;
56 position: relative;
57}
58
59@media (min-width: $tablets) {
60 .section-content-specialisms {
61 flex-direction: row;
62 padding-left: 2rem;
63 padding-right: 2rem;
64 }
65}
66
67.box {
68 display: flex;
69 flex-wrap: wrap;
70 flex-direction: row;
71 padding-right: 6rem;
72 padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78 box-sizing: border-box;
79}
80
81.tile > * {
82 pointer-events: none;
83}
84
85.tile {
86 flex: 1 0 auto;
87 order: 0;
88 flex-basis: 25%;
89 border: 1px solid grey;
90
91 /* For visual only */
92 background-color: #222;
93 height: 150px;
94 text-align: center;
95 font-size: 16px;
96 color: white;
97 cursor: pointer;
98}
99
100.active-tile {
101 flex: 1 0 auto;
102 order: 0;
103 flex-basis: 25%;
104
105 /* For visual only */
106 text-align: center;
107 border: 1px solid #000;
108 background-color: green;
109 cursor: pointer;
110}
111
112.content {
113 order: 1;
114 flex: 1 0 100%;
115
116 /* For visual only */
117 padding: 20px;
118 color: black;
119 text-align: center;
120 border: 1px solid #000;
121 background-color: #228b22;
122}
123
124.description {
125 text-align: left;
126}
127
128.spec-info {
129 text-align: left;
130 width: 50%;
131 float: left;
132}
133
134.percent-icon-size {
135 width: 295px;
136 height: 260px;
137}
138
139.icon-percent {
140 width: 50%;
141 float: right;
142}
143
144.icon-spacing {
145 margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150 content: "";
151 display: table;
152 clear: both;
153}
154
155.closebtn {
156 float: right;
157 color: black;
158 cursor: pointer;
159}
160
161.arrow-down {
162 width: 25px;
163 height: 25px;
164}
165
166.arrow-up {
167 width: 25px;
168 height: 25px;
169 -webkit-transform: rotate(180deg);
170 -moz-transform: rotate(180deg);
171 -ms-transform: rotate(180deg);
172 -o-transform: rotate(180deg);
173 transform: rotate(180deg);
174}
175
176.specialisms-content {
177 padding-top: 25px;
178 padding-bottom: 25px;
179}
180
181.percentage {
182 color: #228b22;
183}
184
185/*
186 "Desktop" and above
187 */
188@media (max-width: 480px) {
189 .box {
190 flex-direction: column;
191 padding-right: 1rem;
192 padding-left: 1rem;
193 }
194
195 .content {
196 order: 0;
197 }
198}
199
200@media (max-width: 768px) {
201 .box {
202 padding-right: 1rem;
203 padding-left: 1rem;
204 }
205}<div class="box">
206 <div class="tile" onclick="openTab('b1', event);">
207 <img class="icon-spacing" src="./assets/Icons/Banking.svg" />
208 <p>Banking</p>
209 <img class="arrow-down" src="./assets/Icons/arrow-down.png" />
210 </div>
211 <div
212 id="b1"
213 class="content"
214 style="display: none; background: white"
215 >
216 <span onclick="closeTab('b1', event)" class="closebtn"
217 >&times;</span
218 >
219 <div class="expanded-content"></div>
220
221 <div class="spec-info">
222 <h3>Banking</h3>
223 <p>
224 Core banking products including personal current accounts,
225 savings and mortgages. This category also includes banking
226 platforms and operations FinTechs such as Railsbank and
227 challenger banks such as Atom.
228 </p>
229 <ul>
230 <li>Banking Personal Current Accounts (PCA)</li>
231 <li>Banking Platforms</li>
232 <li>Banking Operations</li>
233 </ul>
234 </div>
235 <div class="icon-percent">
236 <img src="./assets/37.png" alt="" class="percent-icon-size" />
237 </div>
238 </div>
239<div class="tile" onclick="openTab('b2', event);">
240<img class="icon-spacing" src="./assets/Icons/Regtech.svg" />
241<p>RegTech</p>
242<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
243</div>
244<div id="b2" class="content" style="display: none; background: white">
245<span onclick="closeTab('b2', event)" class="closebtn">&times;</span>
246<div class="description">
247<h3>RegTech - <span class="percentage">10%</span></h3>
248<p>
249 This FinTech category focuses on companies with activities and
250 technology focused on reimagining and streamlining risk (AML, KYC),
251 credit scoring and compliance software.
252</p>
253</div>
254</div>
255<div class="tile" onclick="openTab('b3', event);">
256<img class="icon-spacing" src="./assets/Icons/InsurTech.svg" />
257<p>InsurTech</p>
258<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
259</div>
260<div id="b3" class="content" style="display: none; background: white">
261<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
262<div class="description">
263<h3>InsurTech - <span class="percentage">6%</span></h3>
264<p>
265 InsurTech includes companies selling insurance digitally or introducing
266 new business models or (re)insurance specific software.
267</p>
268<ul>
269 <li>InsurTech - Commercial</li>
270 <li>InsurTech - Personal</li>
271 <li>Insurance Platforms and Operations</li>
272</ul>
273</div>
274</div>
275<div class="tile" onclick="openTab('b4', event);">
276<img class="icon-spacing" src="./assets/Icons/Lending.svg" />
277<p>Lending</p>
278<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
279</div>
280<div id="b4" class="content" style="display: none; background: white">
281<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
282<div class="description">
283<h3>Lending - <span class="percentage">13%</span></h3>
284<p>
285 Companies focused on innnovating credit, from commerical to alternative
286 and specialist lenders or platforms facilitating P2P.
287</p>
288<ul>
289 <li>Consumer Lending</li>
290 <li>Commercial Lending</li>
291 <li>P2P Lending</li>
292</ul>
293</div>
294</div>
295</div>.percent-icon-size {
296 width: 295px;
297 height: 260px;
298}
299
This is keeping this image at the same size no matter how large or small the panel containing the content is. The following snippet would make the image be as large as it can be but be limited to the width of it's container:
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}body {
41 margin: 0;
42 font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46 padding-top: 70px;
47}
48
49.section-content-specialisms {
50 max-width: $page-width;
51 margin: 0 auto;
52 padding: 0 $p-base;
53 margin-bottom: 70px;
54
55 justify-content: space-between;
56 position: relative;
57}
58
59@media (min-width: $tablets) {
60 .section-content-specialisms {
61 flex-direction: row;
62 padding-left: 2rem;
63 padding-right: 2rem;
64 }
65}
66
67.box {
68 display: flex;
69 flex-wrap: wrap;
70 flex-direction: row;
71 padding-right: 6rem;
72 padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78 box-sizing: border-box;
79}
80
81.tile > * {
82 pointer-events: none;
83}
84
85.tile {
86 flex: 1 0 auto;
87 order: 0;
88 flex-basis: 25%;
89 border: 1px solid grey;
90
91 /* For visual only */
92 background-color: #222;
93 height: 150px;
94 text-align: center;
95 font-size: 16px;
96 color: white;
97 cursor: pointer;
98}
99
100.active-tile {
101 flex: 1 0 auto;
102 order: 0;
103 flex-basis: 25%;
104
105 /* For visual only */
106 text-align: center;
107 border: 1px solid #000;
108 background-color: green;
109 cursor: pointer;
110}
111
112.content {
113 order: 1;
114 flex: 1 0 100%;
115
116 /* For visual only */
117 padding: 20px;
118 color: black;
119 text-align: center;
120 border: 1px solid #000;
121 background-color: #228b22;
122}
123
124.description {
125 text-align: left;
126}
127
128.spec-info {
129 text-align: left;
130 width: 50%;
131 float: left;
132}
133
134.percent-icon-size {
135 width: 295px;
136 height: 260px;
137}
138
139.icon-percent {
140 width: 50%;
141 float: right;
142}
143
144.icon-spacing {
145 margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150 content: "";
151 display: table;
152 clear: both;
153}
154
155.closebtn {
156 float: right;
157 color: black;
158 cursor: pointer;
159}
160
161.arrow-down {
162 width: 25px;
163 height: 25px;
164}
165
166.arrow-up {
167 width: 25px;
168 height: 25px;
169 -webkit-transform: rotate(180deg);
170 -moz-transform: rotate(180deg);
171 -ms-transform: rotate(180deg);
172 -o-transform: rotate(180deg);
173 transform: rotate(180deg);
174}
175
176.specialisms-content {
177 padding-top: 25px;
178 padding-bottom: 25px;
179}
180
181.percentage {
182 color: #228b22;
183}
184
185/*
186 "Desktop" and above
187 */
188@media (max-width: 480px) {
189 .box {
190 flex-direction: column;
191 padding-right: 1rem;
192 padding-left: 1rem;
193 }
194
195 .content {
196 order: 0;
197 }
198}
199
200@media (max-width: 768px) {
201 .box {
202 padding-right: 1rem;
203 padding-left: 1rem;
204 }
205}<div class="box">
206 <div class="tile" onclick="openTab('b1', event);">
207 <img class="icon-spacing" src="./assets/Icons/Banking.svg" />
208 <p>Banking</p>
209 <img class="arrow-down" src="./assets/Icons/arrow-down.png" />
210 </div>
211 <div
212 id="b1"
213 class="content"
214 style="display: none; background: white"
215 >
216 <span onclick="closeTab('b1', event)" class="closebtn"
217 >&times;</span
218 >
219 <div class="expanded-content"></div>
220
221 <div class="spec-info">
222 <h3>Banking</h3>
223 <p>
224 Core banking products including personal current accounts,
225 savings and mortgages. This category also includes banking
226 platforms and operations FinTechs such as Railsbank and
227 challenger banks such as Atom.
228 </p>
229 <ul>
230 <li>Banking Personal Current Accounts (PCA)</li>
231 <li>Banking Platforms</li>
232 <li>Banking Operations</li>
233 </ul>
234 </div>
235 <div class="icon-percent">
236 <img src="./assets/37.png" alt="" class="percent-icon-size" />
237 </div>
238 </div>
239<div class="tile" onclick="openTab('b2', event);">
240<img class="icon-spacing" src="./assets/Icons/Regtech.svg" />
241<p>RegTech</p>
242<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
243</div>
244<div id="b2" class="content" style="display: none; background: white">
245<span onclick="closeTab('b2', event)" class="closebtn">&times;</span>
246<div class="description">
247<h3>RegTech - <span class="percentage">10%</span></h3>
248<p>
249 This FinTech category focuses on companies with activities and
250 technology focused on reimagining and streamlining risk (AML, KYC),
251 credit scoring and compliance software.
252</p>
253</div>
254</div>
255<div class="tile" onclick="openTab('b3', event);">
256<img class="icon-spacing" src="./assets/Icons/InsurTech.svg" />
257<p>InsurTech</p>
258<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
259</div>
260<div id="b3" class="content" style="display: none; background: white">
261<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
262<div class="description">
263<h3>InsurTech - <span class="percentage">6%</span></h3>
264<p>
265 InsurTech includes companies selling insurance digitally or introducing
266 new business models or (re)insurance specific software.
267</p>
268<ul>
269 <li>InsurTech - Commercial</li>
270 <li>InsurTech - Personal</li>
271 <li>Insurance Platforms and Operations</li>
272</ul>
273</div>
274</div>
275<div class="tile" onclick="openTab('b4', event);">
276<img class="icon-spacing" src="./assets/Icons/Lending.svg" />
277<p>Lending</p>
278<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
279</div>
280<div id="b4" class="content" style="display: none; background: white">
281<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
282<div class="description">
283<h3>Lending - <span class="percentage">13%</span></h3>
284<p>
285 Companies focused on innnovating credit, from commerical to alternative
286 and specialist lenders or platforms facilitating P2P.
287</p>
288<ul>
289 <li>Consumer Lending</li>
290 <li>Commercial Lending</li>
291 <li>P2P Lending</li>
292</ul>
293</div>
294</div>
295</div>.percent-icon-size {
296 width: 295px;
297 height: 260px;
298}
299.percent-icon-size {
300 width: 100%;
301 max-width: 100%;
302}
303
From here, you could do a couple things
Either keep the 2 columns but change the widths of them (maybe 70/30, etc.) or as you've already mentioned, use a media query and not have columns on smaller screen sizes. The following snippet is an example of the the 2nd approach:
1function openTab(tabName, event) {
2 event.target.classList.add("active-tile");
3 event.target.children[2].classList.add("arrow-up");
4 var i, x;
5 x = document.getElementsByClassName("content");
6 for (i = 0; i < x.length; i++) {
7 x[i].style.display = "none";
8 }
9 document.getElementById(tabName).style.display = "block";
10
11 // Get all the tabs into a collection
12 // (don't use .getElementsByClassName()!)
13 let tabs = document.querySelectorAll(".tile");
14
15 // Set up a click event handler on each of the tabs
16 tabs.forEach(function (tab) {
17 tab.addEventListener("click", function (event) {
18 // Loop over all the tabs and remove the active class
19 tabs.forEach(function (tab) {
20 tab.classList.remove("active-tile");
21 tab.children[2].classList.remove("arrow-up");
22 });
23
24 // Set the background of the clicked tab
25 this.classList.add("active-tile");
26 tab.children[2].classList.add("arrow-up");
27 });
28 });
29}
30function closeTab(tabName, event) {
31 x = document.getElementsByClassName("content");
32 for (i = 0; i < x.length; i++) {
33 x[i].style.display = "none";
34 }
35 let tabs = document.querySelectorAll(".tile");
36 tabs.forEach(function (tab) {
37 tab.classList.remove("active-tile");
38 tab.children[2].classList.remove("arrow-up");
39 });
40}body {
41 margin: 0;
42 font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46 padding-top: 70px;
47}
48
49.section-content-specialisms {
50 max-width: $page-width;
51 margin: 0 auto;
52 padding: 0 $p-base;
53 margin-bottom: 70px;
54
55 justify-content: space-between;
56 position: relative;
57}
58
59@media (min-width: $tablets) {
60 .section-content-specialisms {
61 flex-direction: row;
62 padding-left: 2rem;
63 padding-right: 2rem;
64 }
65}
66
67.box {
68 display: flex;
69 flex-wrap: wrap;
70 flex-direction: row;
71 padding-right: 6rem;
72 padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78 box-sizing: border-box;
79}
80
81.tile > * {
82 pointer-events: none;
83}
84
85.tile {
86 flex: 1 0 auto;
87 order: 0;
88 flex-basis: 25%;
89 border: 1px solid grey;
90
91 /* For visual only */
92 background-color: #222;
93 height: 150px;
94 text-align: center;
95 font-size: 16px;
96 color: white;
97 cursor: pointer;
98}
99
100.active-tile {
101 flex: 1 0 auto;
102 order: 0;
103 flex-basis: 25%;
104
105 /* For visual only */
106 text-align: center;
107 border: 1px solid #000;
108 background-color: green;
109 cursor: pointer;
110}
111
112.content {
113 order: 1;
114 flex: 1 0 100%;
115
116 /* For visual only */
117 padding: 20px;
118 color: black;
119 text-align: center;
120 border: 1px solid #000;
121 background-color: #228b22;
122}
123
124.description {
125 text-align: left;
126}
127
128.spec-info {
129 text-align: left;
130 width: 50%;
131 float: left;
132}
133
134.percent-icon-size {
135 width: 295px;
136 height: 260px;
137}
138
139.icon-percent {
140 width: 50%;
141 float: right;
142}
143
144.icon-spacing {
145 margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150 content: "";
151 display: table;
152 clear: both;
153}
154
155.closebtn {
156 float: right;
157 color: black;
158 cursor: pointer;
159}
160
161.arrow-down {
162 width: 25px;
163 height: 25px;
164}
165
166.arrow-up {
167 width: 25px;
168 height: 25px;
169 -webkit-transform: rotate(180deg);
170 -moz-transform: rotate(180deg);
171 -ms-transform: rotate(180deg);
172 -o-transform: rotate(180deg);
173 transform: rotate(180deg);
174}
175
176.specialisms-content {
177 padding-top: 25px;
178 padding-bottom: 25px;
179}
180
181.percentage {
182 color: #228b22;
183}
184
185/*
186 "Desktop" and above
187 */
188@media (max-width: 480px) {
189 .box {
190 flex-direction: column;
191 padding-right: 1rem;
192 padding-left: 1rem;
193 }
194
195 .content {
196 order: 0;
197 }
198}
199
200@media (max-width: 768px) {
201 .box {
202 padding-right: 1rem;
203 padding-left: 1rem;
204 }
205}<div class="box">
206 <div class="tile" onclick="openTab('b1', event);">
207 <img class="icon-spacing" src="./assets/Icons/Banking.svg" />
208 <p>Banking</p>
209 <img class="arrow-down" src="./assets/Icons/arrow-down.png" />
210 </div>
211 <div
212 id="b1"
213 class="content"
214 style="display: none; background: white"
215 >
216 <span onclick="closeTab('b1', event)" class="closebtn"
217 >&times;</span
218 >
219 <div class="expanded-content"></div>
220
221 <div class="spec-info">
222 <h3>Banking</h3>
223 <p>
224 Core banking products including personal current accounts,
225 savings and mortgages. This category also includes banking
226 platforms and operations FinTechs such as Railsbank and
227 challenger banks such as Atom.
228 </p>
229 <ul>
230 <li>Banking Personal Current Accounts (PCA)</li>
231 <li>Banking Platforms</li>
232 <li>Banking Operations</li>
233 </ul>
234 </div>
235 <div class="icon-percent">
236 <img src="./assets/37.png" alt="" class="percent-icon-size" />
237 </div>
238 </div>
239<div class="tile" onclick="openTab('b2', event);">
240<img class="icon-spacing" src="./assets/Icons/Regtech.svg" />
241<p>RegTech</p>
242<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
243</div>
244<div id="b2" class="content" style="display: none; background: white">
245<span onclick="closeTab('b2', event)" class="closebtn">&times;</span>
246<div class="description">
247<h3>RegTech - <span class="percentage">10%</span></h3>
248<p>
249 This FinTech category focuses on companies with activities and
250 technology focused on reimagining and streamlining risk (AML, KYC),
251 credit scoring and compliance software.
252</p>
253</div>
254</div>
255<div class="tile" onclick="openTab('b3', event);">
256<img class="icon-spacing" src="./assets/Icons/InsurTech.svg" />
257<p>InsurTech</p>
258<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
259</div>
260<div id="b3" class="content" style="display: none; background: white">
261<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
262<div class="description">
263<h3>InsurTech - <span class="percentage">6%</span></h3>
264<p>
265 InsurTech includes companies selling insurance digitally or introducing
266 new business models or (re)insurance specific software.
267</p>
268<ul>
269 <li>InsurTech - Commercial</li>
270 <li>InsurTech - Personal</li>
271 <li>Insurance Platforms and Operations</li>
272</ul>
273</div>
274</div>
275<div class="tile" onclick="openTab('b4', event);">
276<img class="icon-spacing" src="./assets/Icons/Lending.svg" />
277<p>Lending</p>
278<img class="arrow-down" src="./assets/Icons/arrow-down.png" />
279</div>
280<div id="b4" class="content" style="display: none; background: white">
281<span onclick="closeTab('b3', event)" class="closebtn">&times;</span>
282<div class="description">
283<h3>Lending - <span class="percentage">13%</span></h3>
284<p>
285 Companies focused on innnovating credit, from commerical to alternative
286 and specialist lenders or platforms facilitating P2P.
287</p>
288<ul>
289 <li>Consumer Lending</li>
290 <li>Commercial Lending</li>
291 <li>P2P Lending</li>
292</ul>
293</div>
294</div>
295</div>.percent-icon-size {
296 width: 295px;
297 height: 260px;
298}
299.percent-icon-size {
300 width: 100%;
301 max-width: 100%;
302}
303// Mobile, single column
304// If you're using any other "Mobile First" approaches,
305// you may not need the media query
306//
307// I'm arbitrarily selecting a max-width pixel value;
308// you'd want to update this according to your needs.
309@media (max-width: 767px) {
310 .spec-info, .icon-percent {
311 width: 100%;
312 float: none;
313 }
314
315 .percent-icon-size {
316 width: 100%;
317 max-width: 100%;
318 }
319}
320
Hope this helps, happy coding.
QUESTION
How can I solve the npm run dev error I'm facing after creating a new Laravel 7 project?
Asked 2021-Feb-23 at 09:47I have created a new Laravel 7 project and after doing so, ran the command npm install and all the packages in my package.json were downloaded into the node_modules directory. Then i tried running the command npm run dev and keeps on failing.
I'm using the following versions
- PHP 7.4.11
- Laravel installer 4.11
- Node v15.0.1
- npm 7.0.3
- Composer 2.0.9
This is my package.json file
1{
2"private": true,
3"scripts": {
4 "dev": "npm run development",
5 "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6 "watch": "npm run development -- --watch",
7 "watch-poll": "npm run watch -- --watch-poll",
8 "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
9 "prod": "npm run production",
10 "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
11},
12"devDependencies": {
13 "autoprefixer": "^10.2.4",
14 "axios": "^0.21.1",
15 "cross-env": "^7.0.3",
16 "laravel-mix": "^5.0.1",
17 "lodash": "^4.17.13",
18 "resolve-url-loader": "^3.1.0",
19 "sass": "^1.15.2",
20 "sass-loader": "^8.0.0",
21 "webpack": "^5.21.2",
22 "webpack-cli": "^4.5.0"
23},
24"name": "MyProject"
25}
26
This is the error I get after running npm run watch or npm run dev
1{
2"private": true,
3"scripts": {
4 "dev": "npm run development",
5 "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6 "watch": "npm run development -- --watch",
7 "watch-poll": "npm run watch -- --watch-poll",
8 "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
9 "prod": "npm run production",
10 "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
11},
12"devDependencies": {
13 "autoprefixer": "^10.2.4",
14 "axios": "^0.21.1",
15 "cross-env": "^7.0.3",
16 "laravel-mix": "^5.0.1",
17 "lodash": "^4.17.13",
18 "resolve-url-loader": "^3.1.0",
19 "sass": "^1.15.2",
20 "sass-loader": "^8.0.0",
21 "webpack": "^5.21.2",
22 "webpack-cli": "^4.5.0"
23},
24"name": "MyProject"
25}
26> dev
27> npm run development
28
29
30> development
31> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules -
32 -config=node_modules/laravel-mix
33/setup/webpack.config.js
34npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "cross-env NODE_ENV=development
35node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-
36mix/setup/webpack.config.js"
37
38npm ERR! A complete log of this run can be found in:
39npm ERR! C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_575Z-
40debug.log
41npm ERR! code 2
42npm ERR! path C:\Users\Rolling Sure\Desktop\Code Fintech\duplicate\MyProject
43npm ERR! command failed
44npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "npm run development"
45
46npm ERR! A complete log of this run can be found in:
47npm ERR! C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_652Z-
48debug.log
49
ANSWER
Answered 2021-Feb-23 at 09:47You could try reinstalling the node packages.
- Delete the node_modules folder.
- run
npm install
again
QUESTION
getting error when trying to convert object column into int
Asked 2021-Feb-07 at 08:53I have a dataframe in which few of the columns are object, and I want to change one of them into a int column so I can work with it. and do some calculation. but when ever am trying to do it am getting this error.
here's my code.
code which giving me the error.
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4
error
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4 ---------------------------------------------------------------------------
5ValueError Traceback (most recent call last)
6<ipython-input-21-b9d8d4e75b08> in <module>
7----> 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10 5870 else:
11 5871 # else, only a single dtype is given
12-> 5872 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13 5873 return self._constructor(new_data).__finalize__(self, method="astype")
14 5874
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17 629 self, dtype, copy: bool = False, errors: str = "raise"
18 630 ) -> "BlockManager":
19--> 631 return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
20 632
21 633 def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24 425 applied = b.apply(f, **kwargs)
25 426 else:
26--> 427 applied = getattr(b, f)(**kwargs)
27 428 except (TypeError, NotImplementedError):
28 429 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31 671 vals1d = values.ravel()
32 672 try:
33--> 673 values = astype_nansafe(vals1d, dtype, copy=True)
34 674 except (ValueError, TypeError):
35 675 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38 1072 # work around NumPy brokenness, #1987
39 1073 if np.issubdtype(dtype.type, np.integer):
40-> 1074 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41 1075
42 1076 # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
47
info about the data frame.
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4 ---------------------------------------------------------------------------
5ValueError Traceback (most recent call last)
6<ipython-input-21-b9d8d4e75b08> in <module>
7----> 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10 5870 else:
11 5871 # else, only a single dtype is given
12-> 5872 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13 5873 return self._constructor(new_data).__finalize__(self, method="astype")
14 5874
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17 629 self, dtype, copy: bool = False, errors: str = "raise"
18 630 ) -> "BlockManager":
19--> 631 return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
20 632
21 633 def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24 425 applied = b.apply(f, **kwargs)
25 426 else:
26--> 427 applied = getattr(b, f)(**kwargs)
27 428 except (TypeError, NotImplementedError):
28 429 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31 671 vals1d = values.ravel()
32 672 try:
33--> 673 values = astype_nansafe(vals1d, dtype, copy=True)
34 674 except (ValueError, TypeError):
35 675 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38 1072 # work around NumPy brokenness, #1987
39 1073 if np.issubdtype(dtype.type, np.integer):
40-> 1074 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41 1075
42 1076 # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470 Sr No 3044 non-null int64
48 1 Date dd/mm/yyyy 3044 non-null object
49 2 Startup Name 3044 non-null object
50 3 Industry Vertical 2873 non-null object
51 4 SubVertical 2108 non-null object
52 5 City Location 2864 non-null object
53 6 Investors Name 3020 non-null object
54 7 InvestmentnType 3040 non-null object
55 8 Amount in USD 2084 non-null object
56 9 Remarks 419 non-null object
57
here the sample of my data frame
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4 ---------------------------------------------------------------------------
5ValueError Traceback (most recent call last)
6<ipython-input-21-b9d8d4e75b08> in <module>
7----> 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10 5870 else:
11 5871 # else, only a single dtype is given
12-> 5872 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13 5873 return self._constructor(new_data).__finalize__(self, method="astype")
14 5874
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17 629 self, dtype, copy: bool = False, errors: str = "raise"
18 630 ) -> "BlockManager":
19--> 631 return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
20 632
21 633 def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24 425 applied = b.apply(f, **kwargs)
25 426 else:
26--> 427 applied = getattr(b, f)(**kwargs)
27 428 except (TypeError, NotImplementedError):
28 429 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31 671 vals1d = values.ravel()
32 672 try:
33--> 673 values = astype_nansafe(vals1d, dtype, copy=True)
34 674 except (ValueError, TypeError):
35 675 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38 1072 # work around NumPy brokenness, #1987
39 1073 if np.issubdtype(dtype.type, np.integer):
40-> 1074 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41 1075
42 1076 # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470 Sr No 3044 non-null int64
48 1 Date dd/mm/yyyy 3044 non-null object
49 2 Startup Name 3044 non-null object
50 3 Industry Vertical 2873 non-null object
51 4 SubVertical 2108 non-null object
52 5 City Location 2864 non-null object
53 6 Investors Name 3020 non-null object
54 7 InvestmentnType 3040 non-null object
55 8 Amount in USD 2084 non-null object
56 9 Remarks 419 non-null object
57Sr No Date dd/mm/yyyy Startup Name Industry Vertical SubVertical City Location Investors Name InvestmentnType Amount in USD Remarks
580 1 09/01/2020 BYJU’S E-Tech E-learning Bengaluru Tiger Global Management Private Equity Round 20,00,00,000 NaN
591 2 13/01/2020 Shuttl Transportation App based shuttle service Gurgaon Susquehanna Growth Equity Series C 80,48,394 NaN
602 3 09/01/2020 Mamaearth E-commerce Retailer of baby and toddler products Bengaluru Sequoia Capital India Series B 1,83,58,860 NaN
613 4 02/01/2020 https://www.wealthbucket.in/ FinTech Online Investment New Delhi Vinod Khatumal Pre-series A 30,00,000 NaN
62
ANSWER
Answered 2021-Feb-07 at 08:53There is a categorical variable instance 'undisclosed'
in your df['Amount in USD']
which cannot be converted to int
per se.
You need to map values that are not numeric with string type on your own, i.e.:
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4 ---------------------------------------------------------------------------
5ValueError Traceback (most recent call last)
6<ipython-input-21-b9d8d4e75b08> in <module>
7----> 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10 5870 else:
11 5871 # else, only a single dtype is given
12-> 5872 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13 5873 return self._constructor(new_data).__finalize__(self, method="astype")
14 5874
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17 629 self, dtype, copy: bool = False, errors: str = "raise"
18 630 ) -> "BlockManager":
19--> 631 return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
20 632
21 633 def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24 425 applied = b.apply(f, **kwargs)
25 426 else:
26--> 427 applied = getattr(b, f)(**kwargs)
27 428 except (TypeError, NotImplementedError):
28 429 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31 671 vals1d = values.ravel()
32 672 try:
33--> 673 values = astype_nansafe(vals1d, dtype, copy=True)
34 674 except (ValueError, TypeError):
35 675 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38 1072 # work around NumPy brokenness, #1987
39 1073 if np.issubdtype(dtype.type, np.integer):
40-> 1074 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41 1075
42 1076 # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470 Sr No 3044 non-null int64
48 1 Date dd/mm/yyyy 3044 non-null object
49 2 Startup Name 3044 non-null object
50 3 Industry Vertical 2873 non-null object
51 4 SubVertical 2108 non-null object
52 5 City Location 2864 non-null object
53 6 Investors Name 3020 non-null object
54 7 InvestmentnType 3040 non-null object
55 8 Amount in USD 2084 non-null object
56 9 Remarks 419 non-null object
57Sr No Date dd/mm/yyyy Startup Name Industry Vertical SubVertical City Location Investors Name InvestmentnType Amount in USD Remarks
580 1 09/01/2020 BYJU’S E-Tech E-learning Bengaluru Tiger Global Management Private Equity Round 20,00,00,000 NaN
591 2 13/01/2020 Shuttl Transportation App based shuttle service Gurgaon Susquehanna Growth Equity Series C 80,48,394 NaN
602 3 09/01/2020 Mamaearth E-commerce Retailer of baby and toddler products Bengaluru Sequoia Capital India Series B 1,83,58,860 NaN
613 4 02/01/2020 https://www.wealthbucket.in/ FinTech Online Investment New Delhi Vinod Khatumal Pre-series A 30,00,000 NaN
62df['Amount in USD'] = df['Amount in USD'].replace('undisclosed', '-1')
63df['Amount in USD'] = df['Amount in USD'].astype(int)
64
I make the assumption here, that there is no '-1'
values in your df['Amount in USD']
column. You can check the unique values for that column like so:
1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4 ---------------------------------------------------------------------------
5ValueError Traceback (most recent call last)
6<ipython-input-21-b9d8d4e75b08> in <module>
7----> 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10 5870 else:
11 5871 # else, only a single dtype is given
12-> 5872 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13 5873 return self._constructor(new_data).__finalize__(self, method="astype")
14 5874
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17 629 self, dtype, copy: bool = False, errors: str = "raise"
18 630 ) -> "BlockManager":
19--> 631 return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
20 632
21 633 def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24 425 applied = b.apply(f, **kwargs)
25 426 else:
26--> 427 applied = getattr(b, f)(**kwargs)
27 428 except (TypeError, NotImplementedError):
28 429 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31 671 vals1d = values.ravel()
32 672 try:
33--> 673 values = astype_nansafe(vals1d, dtype, copy=True)
34 674 except (ValueError, TypeError):
35 675 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38 1072 # work around NumPy brokenness, #1987
39 1073 if np.issubdtype(dtype.type, np.integer):
40-> 1074 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41 1075
42 1076 # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470 Sr No 3044 non-null int64
48 1 Date dd/mm/yyyy 3044 non-null object
49 2 Startup Name 3044 non-null object
50 3 Industry Vertical 2873 non-null object
51 4 SubVertical 2108 non-null object
52 5 City Location 2864 non-null object
53 6 Investors Name 3020 non-null object
54 7 InvestmentnType 3040 non-null object
55 8 Amount in USD 2084 non-null object
56 9 Remarks 419 non-null object
57Sr No Date dd/mm/yyyy Startup Name Industry Vertical SubVertical City Location Investors Name InvestmentnType Amount in USD Remarks
580 1 09/01/2020 BYJU’S E-Tech E-learning Bengaluru Tiger Global Management Private Equity Round 20,00,00,000 NaN
591 2 13/01/2020 Shuttl Transportation App based shuttle service Gurgaon Susquehanna Growth Equity Series C 80,48,394 NaN
602 3 09/01/2020 Mamaearth E-commerce Retailer of baby and toddler products Bengaluru Sequoia Capital India Series B 1,83,58,860 NaN
613 4 02/01/2020 https://www.wealthbucket.in/ FinTech Online Investment New Delhi Vinod Khatumal Pre-series A 30,00,000 NaN
62df['Amount in USD'] = df['Amount in USD'].replace('undisclosed', '-1')
63df['Amount in USD'] = df['Amount in USD'].astype(int)
64`df['Amount in USD']`.unique()
65
Feel free to add those contents to your question so I can assist you further.
EDIT Bonus:
Depending on what calculations you want to perform on that column you need to carefully select the integers. There are several good guides available online:
- https://machinelearningmastery.com/one-hot-encoding-for-categorical-data/
- https://pbpython.com/categorical-encoding.html
Make sure that it also fits your domain which does look like finance to me.
Community Discussions contain sources that include Stack Exchange Network